From 6984d767338544d33d6fd7ef900141d3dfd0d439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Fri, 7 Sep 2018 21:28:42 +0200 Subject: [PATCH] --- commands/{general => fun}/meow.js | 2 +- index.js | 14 +++++++++++--- reply.json | 4 ++++ 3 files changed, 16 insertions(+), 4 deletions(-) rename commands/{general => fun}/meow.js (92%) create mode 100644 reply.json diff --git a/commands/general/meow.js b/commands/fun/meow.js similarity index 92% rename from commands/general/meow.js rename to commands/fun/meow.js index 4718843c..24fc05a6 100644 --- a/commands/general/meow.js +++ b/commands/fun/meow.js @@ -3,7 +3,7 @@ module.exports = class MeowCommand extends Command { constructor(client) { super(client, { name: 'meow', - group: 'general', + group: 'fun', memberName: 'meow', description: 'Replies with a meow, kitty cat.', }); diff --git a/index.js b/index.js index b48b40b8..de0dbe87 100644 --- a/index.js +++ b/index.js @@ -1,30 +1,38 @@ const { CommandoClient } = require('discord.js-commando'); const path = require('path'); const { token } = require('./config.json'); +const responseObject = require("./reply.json"); - +// Prefix and ownerID and invite to support server const client = new CommandoClient({ commandPrefix: 'hehe ', owner: '267065637183029248', invite: 'https://discord.gg/SsMCsVY', }); - +// Command groups client.registry .registerDefaultTypes() .registerGroups([ ['general', 'The most used commands'], ['admin', 'Commands to make admin life easier'], ['owner', 'Commands the owner can use to manage the bot'], + ['fun', 'Fun commands'], ]) .registerDefaultGroups() .registerDefaultCommands() .registerCommandsIn(path.join(__dirname, 'commands')); - +// Ready messages client.on('ready', () => { console.log(`Logged in as ${client.user.tag}! (${client.user.id})`); console.log(`Ready to serve in ${client.channels.size} channels on ${client.guilds.size} servers, for a total of ${client.users.size} users.`); client.user.setActivity('with nobody :('); }); +// Auto respond to messages + client.on("message", (message) => { + if(responseObject[message.content]) { + message.channel.send(responseObject[message.content]); + } + }); client.on('error', console.error); diff --git a/reply.json b/reply.json new file mode 100644 index 00000000..c2ce828e --- /dev/null +++ b/reply.json @@ -0,0 +1,4 @@ +{ + "haha": "haha yes", + "lol": "veri fun" +} \ No newline at end of file