From c8d0aedf217824a930ad7276523c20cb2a6e4a7a Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Mon, 20 Mar 2017 13:31:16 +0000 Subject: [PATCH] Server Join Post to Announcements, Lenny Command --- commands/random/lenny.js | 24 ++++++++++++++++++++++++ index.js | 6 ++++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 commands/random/lenny.js diff --git a/commands/random/lenny.js b/commands/random/lenny.js new file mode 100644 index 00000000..c62033b6 --- /dev/null +++ b/commands/random/lenny.js @@ -0,0 +1,24 @@ +const commando = require('discord.js-commando'); + +class LennyCommand extends commando.Command { + constructor(Client){ + super(Client, { + name: 'lenny', + group: 'random', + memberName: 'lenny', + description: 'Responds with the lenny face. (;lenny)', + examples: [';lenny'] + }); + } + + 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); + message.channel.send('( ͡° ͜ʖ ͡°)'); + } +} + +module.exports = LennyCommand; \ No newline at end of file diff --git a/index.js b/index.js index 6f14a791..adde1d1f 100644 --- a/index.js +++ b/index.js @@ -78,7 +78,8 @@ client.on('guildMemberRemove', member => { }); client.on('guildCreate', guild => { - console.log("[Guild] I have joined the guild: " + guild.name + " (" + guild.id + ")!"); + console.log("[Guild] I have joined the guild: " + guild.name + ", " + guild.owner.user.username + " (" + guild.id + ")!"); + client.guilds.get(config.server).channels.get('265503171835592704').send("I have joined the guild: " + guild.name + " (Owner: " + guild.owner.user.username + ")!"); client.shard.fetchClientValues('guilds.size').then(results => { console.log("[Guild Count] " + results.reduce((prev, val) => prev + val, 0)); const carbonPOST = { @@ -115,7 +116,8 @@ client.on('guildCreate', guild => { }); client.on('guildDelete', guild => { - console.log("[Guild] I have left the guild: " + guild.name + " (" + guild.id + ")..."); + console.log("[Guild] I have left the guild: " + guild.name + ", " + guild.owner.user.username + " (" + guild.id + ")..."); + client.guilds.get(config.server).channels.get('265503171835592704').send("I have left the guild: " + guild.name + " (Owner: " + guild.owner.user.username + ")..."); client.shard.fetchClientValues('guilds.size').then(results => { console.log("[Guild Count] " + results.reduce((prev, val) => prev + val, 0)); const carbonPOST = {