.konfuzius
This commit is contained in:
parent
74c8eefc40
commit
a59e8f99aa
@ -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(/<a href=\".*\" class=\"block.*\">\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.+?>(.+?)<\/a>/g, '$1')
|
||||
.match(/<ul><li>\"(.*?)\" - <i>.*?<\/ul>/gm)
|
||||
.map(a => a.match(/\"(.*)\"/)[1]);
|
||||
|
||||
return e.reply(`[b]Konfuzius sagt:[/b] ${quotes[~~(Math.random() * quotes.length)]}`);
|
||||
}
|
||||
}];
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user