Simp-O-Matic

Dumb Discord bot in TS.
git clone git://git.knutsen.co/Simp-O-Matic
Log | Files | Refs | README | LICENSE

wikipedia.ts (308B)


1
2
3
4
5
6
import fetch from 'node-fetch';
export default (homescope: HomeScope) => {
	const { message, args } = homescope;
	fetch(`https://en.wikipedia.org/w/api.php?action=opensearch&search=${args.join(' ') || 'empty set'}&limit=1&format=json`)
	.then(j => j.json()).then(j => message.reply(j[3] || 'not found'));
};