Fact Command Added

This commit is contained in:
dragonfire535
2017-03-03 18:16:21 -05:00
parent 8a2232294a
commit 3ff7b9fd14
3 changed files with 30 additions and 1 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ class InfoCommand extends commando.Command {
.addField('Lib', .addField('Lib',
"[discord.js](https://discord.js.org/#/) (master)", true) "[discord.js](https://discord.js.org/#/) (master)", true)
.addField('Packages', .addField('Packages',
"[Commando](https://github.com/Gawdl3y/discord.js-commando) (0.9.0), [cleverbot-node](https://github.com/fojas/cleverbot-node) (0.3.5), [pirate-speak](https://github.com/mikewesthad/pirate-speak) (1.0.1), [JIMP](https://github.com/oliver-moran/jimp) (0.2.27), [google-translate-api](https://github.com/matheuss/google-translate-api) (2.2.2), [urban](https://github.com/mvrilo/urban) (0.3.1), [zalgoize](https://github.com/clux/zalgolize) (1.2.4), [hepburn](https://github.com/lovell/hepburn) (1.0.0)") "[Commando](https://github.com/Gawdl3y/discord.js-commando) (0.9.0), [cleverbot-node](https://github.com/fojas/cleverbot-node) (0.3.5), [pirate-speak](https://github.com/mikewesthad/pirate-speak) (1.0.1), [JIMP](https://github.com/oliver-moran/jimp) (0.2.27), [google-translate-api](https://github.com/matheuss/google-translate-api) (2.2.2), [urban](https://github.com/mvrilo/urban) (0.3.1), [zalgoize](https://github.com/clux/zalgolize) (1.2.4), [hepburn](https://github.com/lovell/hepburn) (1.0.0), [wikifakt](https://github.com/coffee-cup/wikifakt) (1.0.3)")
.addField('Other Credit', .addField('Other Credit',
"[Cleverbot API](https://www.cleverbot.com/api/)") "[Cleverbot API](https://www.cleverbot.com/api/)")
.addField('My Server', .addField('My Server',
+28
View File
@@ -0,0 +1,28 @@
const commando = require('discord.js-commando');
const WikiFakt = require('wikifakt');
class FactCommand extends commando.Command {
constructor(Client){
super(Client, {
name: 'fact',
group: 'response',
memberName: 'fact',
description: 'Gets a random fact. (;fact)',
examples: [';fact']
});
}
async run(message, args) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission('SEND_MESSAGES')) return;
if(!message.channel.permissionsFor(this.client.user).hasPermission('READ_MESSAGES')) return;
}
console.log("[Command] " + message.content);
WikiFakt.preload = false;
WikiFakt.getRandomFact().then(function(fact) {
message.channel.sendMessage(fact);
});
}
}
module.exports = FactCommand;
+1
View File
@@ -20,6 +20,7 @@
"jimp": "^0.2.27", "jimp": "^0.2.27",
"pirate-speak": "^1.0.1", "pirate-speak": "^1.0.1",
"urban": "^0.3.1", "urban": "^0.3.1",
"wikifakt": "^1.0.3",
"zalgolize": "^1.2.4" "zalgolize": "^1.2.4"
} }
} }