merge-requests/4/head
loicbersier 5 years ago
commit 6a33780f38

@ -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;
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;

@ -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'));

@ -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'));

@ -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}));
}
}
}

Loading…
Cancel
Save