diff --git a/src/inc/trigger/useless_huan.mjs b/src/inc/trigger/useless_huan.mjs
index 48ae603..f246bdd 100644
--- a/src/inc/trigger/useless_huan.mjs
+++ b/src/inc/trigger/useless_huan.mjs
@@ -2,7 +2,8 @@ import fetch from "flumm-fetch-cookies";
const apis = {
launch: 'https://fdo.rocketlaunch.live/json/launches/next/1',
- fml: 'https://www.fmylife.com/random'
+ fml: 'https://www.fmylife.com/random',
+ konfuzius: 'https://de.wikiquote.org/w/api.php?action=parse&format=json&pageid=155§ion=2',
};
@@ -48,5 +49,24 @@ export default async bot => {
}
return e.reply(res.match(/\n(.*?)\n<\/a>/im)[1]);
}
+ }, {
+ name: "konfuzius",
+ call: /^\.konfuzius/i,
+ set: "huan",
+ f: async e => {
+ let res;
+ try {
+ res = (await (await fetch(apis.konfuzius)).json()).parse.text['*'];
+ } catch(err) {
+ console.error(err);
+ }
+
+ const quotes = res
+ .replace(/(.+?)<\/a>/g, '$1')
+ .match(/- \"(.*?)\" - .*?<\/ul>/gm)
+ .map(a => a.match(/\"(.*)\"/)[1]);
+
+ return e.reply(`[b]Konfuzius sagt:[/b] ${quotes[~~(Math.random() * quotes.length)]}`);
+ }
}];
};