mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-30 02:55:44 -05:00
f078a5e056
i found out about this when i did .wiki and nothing happens
37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
/* eslint-disable max-len */
|
|
const wiki = require('wikipedia');
|
|
const util = require('util');
|
|
const {MessageEmbed} = require('discord.js');
|
|
module.exports = {
|
|
name: 'wikipedia',
|
|
alias: ['wiki'],
|
|
description: 'Working Wikipedia!',
|
|
usage: '<page>',
|
|
trusted: 0,
|
|
execute: async function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
|
try {
|
|
const page = await wiki.page(args.join(' '));
|
|
const summary = await page.summary();
|
|
bot.tellraw(selector, {text: summary.extract, color: 'green'});
|
|
} catch (e) {
|
|
bot.tellraw(selector, {text: e.toString(), color: 'red'});
|
|
}
|
|
},
|
|
discordExecute: async function(bot, username, usernameraw, sender, prefix, args, channeldc) {
|
|
try {
|
|
const page = await wiki.page(args.join(' '));
|
|
const summary = await page.summary();
|
|
const Embed = new MessageEmbed()
|
|
.setColor('#FFFF00')
|
|
.setTitle('Output')
|
|
.setDescription(summary.extract);
|
|
channeldc.send({embeds: [Embed]});
|
|
} catch (e) {
|
|
const Embed = new MessageEmbed()
|
|
.setColor('#FF0000')
|
|
.setTitle('Error')
|
|
.setDescription(`\`\`\`${util.inspect(e)}\`\`\``);
|
|
channeldc.send({embeds: [Embed]});
|
|
}
|
|
},
|
|
};
|