Simp-O-Matic

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

search.ts (464B)


import web_search from '../api/google';
import { TextChannel } from 'discord.js';

export default (homescope: HomeScope) => {
	const { message, args, SECRETS } = homescope;
	const query = args.join(' ').toLowerCase();
	const channel = message.channel as TextChannel;

	web_search({
		kind: 'web',
		query,
		key: SECRETS.google.api_key,
		id: SECRETS.google.search_id,
		nsfw: channel.nsfw
	}).then((res) => message.reply(res))
		.catch(e => message.reply(e));
};