From a65b2c90871b0de5c25f1ca83e2197d7cc7835cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Mon, 2 Dec 2019 23:36:33 +0000 Subject: [PATCH 1/3] Removed useless ) --- commands/minigame/rps.js | 130 +++++++++++++++++++-------------------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/commands/minigame/rps.js b/commands/minigame/rps.js index d58139ec..60f9f016 100644 --- a/commands/minigame/rps.js +++ b/commands/minigame/rps.js @@ -1,65 +1,65 @@ -const { Command } = require('discord-akairo'); - -class rpsCommand extends Command { - constructor() { - super('rps', { - aliases: ['rps', 'rockpapersci'], - category: 'minigame', - clientPermissions: ['SEND_MESSAGES'], - args: [ - { - id: 'selection', - type: 'string', - match: 'rest', - }, - ], - description: { - content: 'Simply rock paper scissors\nCredit to: druid#0425 (276882603158798336))', - usage: '[rock/paper/scissors]', - examples: ['rock'] - } - }); - } - - async exec(message, args) { - let pcHand = Math.floor((Math.random()*3)+1); - let playerHand = args.selection; - - switch (playerHand) { - case 'rock': - if (pcHand==1) { - message.channel.send('You both chose rock!'); - } else if (pcHand==2) { - message.channel.send('The bot chose paper, you lose!'); - } else { - message.channel.send('The bot chose scissors, you win!'); - } - break; - case 'paper': - if (pcHand==1) { - message.channel.send('You both chose paper!'); - } else if (pcHand==2) { - message.channel.send('The bot chose scissors, you lose!'); - } else { - message.channel.send('The bot chose rock, you win!'); - } - break; - case 'scissors': - if (pcHand==1) { - message.channel.send('You both chose scissors!'); - } else if (pcHand==2) { - message.channel.send('The bot chose rock, you lose!'); - } else { - message.channel.send('The bot chose paper, you win!'); - } - break; - - default: - message.channel.send(`You entered ${playerHand} which is an incorrect choice.`); - break; - } - - } -} - -module.exports = rpsCommand; \ No newline at end of file +const { Command } = require('discord-akairo'); + +class rpsCommand extends Command { + constructor() { + super('rps', { + aliases: ['rps', 'rockpapersci'], + category: 'minigame', + clientPermissions: ['SEND_MESSAGES'], + args: [ + { + id: 'selection', + type: 'string', + match: 'rest', + }, + ], + description: { + content: 'Simply rock paper scissors\nCredit to: druid#0425 (276882603158798336)', + usage: '[rock/paper/scissors]', + examples: ['rock'] + } + }); + } + + async exec(message, args) { + let pcHand = Math.floor((Math.random()*3)+1); + let playerHand = args.selection; + + switch (playerHand) { + case 'rock': + if (pcHand==1) { + message.channel.send('You both chose rock!'); + } else if (pcHand==2) { + message.channel.send('The bot chose paper, you lose!'); + } else { + message.channel.send('The bot chose scissors, you win!'); + } + break; + case 'paper': + if (pcHand==1) { + message.channel.send('You both chose paper!'); + } else if (pcHand==2) { + message.channel.send('The bot chose scissors, you lose!'); + } else { + message.channel.send('The bot chose rock, you win!'); + } + break; + case 'scissors': + if (pcHand==1) { + message.channel.send('You both chose scissors!'); + } else if (pcHand==2) { + message.channel.send('The bot chose rock, you lose!'); + } else { + message.channel.send('The bot chose paper, you win!'); + } + break; + + default: + message.channel.send(`You entered ${playerHand} which is an incorrect choice.`); + break; + } + + } +} + +module.exports = rpsCommand; From 7d42df6737d9622a26008be1ae43fac02c69c2c6 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Fri, 6 Dec 2019 16:54:37 +0100 Subject: [PATCH 2/3] Fix join/leave message --- event/listeners/guildMemberAdd.js | 2 +- event/listeners/guildMemberRemove.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/event/listeners/guildMemberAdd.js b/event/listeners/guildMemberAdd.js index 6532ba6a..eda1c12c 100644 --- a/event/listeners/guildMemberAdd.js +++ b/event/listeners/guildMemberAdd.js @@ -15,7 +15,7 @@ class guildMemberAddListener extends Listener { guild.setNickname('fart piss'); } - const join = await joinChannel.findOne({where: {guildID: guild.id}}); + const join = await joinChannel.findOne({where: {guildID: guild.guild.id}}); if (join) { const channel = this.client.channels.get(join.get('channelID')); diff --git a/event/listeners/guildMemberRemove.js b/event/listeners/guildMemberRemove.js index 1d213ab6..f6c54418 100644 --- a/event/listeners/guildMemberRemove.js +++ b/event/listeners/guildMemberRemove.js @@ -11,7 +11,7 @@ class guildMemberRemoveListener extends Listener { } async exec(guild) { - const leave = await leaveChannel.findOne({where: {guildID: guild.id}}); + const leave = await leaveChannel.findOne({where: {guildID: guild.guild.id}}); if (leave) { const channel = this.client.channels.get(leave.get('channelID')); From 2339a7987705c28bc5f5b82b36b6b9e1399c14af Mon Sep 17 00:00:00 2001 From: loicbersier Date: Fri, 6 Dec 2019 18:48:51 +0100 Subject: [PATCH 3/3] make async --- event/listeners/messageReactionAdd.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/event/listeners/messageReactionAdd.js b/event/listeners/messageReactionAdd.js index 964c73a2..d26e241c 100644 --- a/event/listeners/messageReactionAdd.js +++ b/event/listeners/messageReactionAdd.js @@ -50,7 +50,7 @@ class MessageReactionAddListener extends Listener { } } - function sendEmbed(name, emote, client) { + async function sendEmbed(name, emote, client) { let channel; if (name == 'starboard') { channel = client.channels.get(starboardChannel['starboard']); @@ -78,7 +78,7 @@ class MessageReactionAddListener extends Listener { } else { Embed.setDescription(messageContent); return channel.send({files: messageAttachments, embed: Embed}) - .catch(() => channel.send(messageAttachments, { embed: Embed})); + .catch(async () => channel.send(messageAttachments, { embed: Embed})); } } }