From 89bb87236b5f19b920ca189a5c8220b1ae907d4b Mon Sep 17 00:00:00 2001 From: TheEdgeNK Date: Thu, 28 Jun 2018 22:40:09 -0400 Subject: Added the start of alliances! --- commands/Pokemon/join.js | 62 --------------------------------------- commands/Pokemon/joinalliance.js | 62 +++++++++++++++++++++++++++++++++++++++ commands/Pokemon/leave.js | 35 ---------------------- commands/Pokemon/leavealliance.js | 35 ++++++++++++++++++++++ events/guildMemberAdd.js | 2 +- 5 files changed, 98 insertions(+), 98 deletions(-) delete mode 100644 commands/Pokemon/join.js create mode 100644 commands/Pokemon/joinalliance.js delete mode 100644 commands/Pokemon/leave.js create mode 100644 commands/Pokemon/leavealliance.js diff --git a/commands/Pokemon/join.js b/commands/Pokemon/join.js deleted file mode 100644 index 2187eef..0000000 --- a/commands/Pokemon/join.js +++ /dev/null @@ -1,62 +0,0 @@ -/** ************************************** - * - * Join: Plugin for PokeBot that powers the PokeWorld team system. - * Copyright (C) 2018 TheEdge, jtsshieh, Alee - * - * Licensed under the Open Software License version 3.0 - * - * *************************************/ - -exports.run = async (bot, msg, args) => { - const isWhitelist = await bot.plugins.whitelist.isWhitelist(msg.guild.id); - if (!isWhitelist) return msg.reply ('This is a Whiltelisted command. Only whitelisted servers can use this command. Sorry!'); - - if (args.length < 1) return msg.reply('Please choose a team to join'); - - const team = findTeam(msg, args[0]); - switch (args[0]) - { - case 'skull': { - msg.member.addRole(msg.guild.roles.find('name', 'Skull')); - msg.reply(`Alright, ${team ? 'you have left team ' + team + ' and ' : 'you have '}joined team Skull.`); - break; - } - case 'flare' : { - msg.member.addRole(msg.guild.roles.find('name', 'Flare')); - msg.reply(`Alright, ${team ? 'you have left team ' + team + ' and ' : 'you have '}joined team Flare.`); - break; - } - default : { - msg.reply('You have to pick skull, or flare.'); - break; - } - } -}; - -function findTeam(msg, team) { - - let oldTeam; - - if (msg.member.roles.find('name', 'Skull')) { - if (team == 'skull') return; - msg.member.removeRole(msg.guild.roles.find('name', 'Skull')); - oldTeam = 'Skull'; - } - else if (msg.member.roles.find('name', 'Flare')) { - if (team == 'flare') return; - msg.member.removeRole(msg.guild.roles.find('name', 'Flare')); - oldTeam = 'Flare'; - } - return oldTeam; -} - -exports.conf = { - aliases: ['pick', 'choose'], - guildOnly: true, -}; - -exports.help = { - name: 'join', - description: 'Join one of the teams!', - usage: '', -}; diff --git a/commands/Pokemon/joinalliance.js b/commands/Pokemon/joinalliance.js new file mode 100644 index 0000000..33c84ba --- /dev/null +++ b/commands/Pokemon/joinalliance.js @@ -0,0 +1,62 @@ +/** ************************************** + * + * Join: Plugin for PokeBot that powers the PokeWorld team system. + * Copyright (C) 2018 TheEdge, jtsshieh, Alee + * + * Licensed under the Open Software License version 3.0 + * + * *************************************/ + +exports.run = async (bot, msg, args) => { + const isWhitelist = await bot.plugins.whitelist.isWhitelist(msg.guild.id); + if (!isWhitelist) return msg.reply ('This is a Whiltelisted command. Only whitelisted servers can use this command. Sorry!'); + + if (args.length < 1) return msg.reply('Please choose an alliance to join'); + + const team = findTeam(msg, args[0]); + switch (args[0]) + { + case 'Skull': { + msg.member.addRole(msg.guild.roles.find('name', 'Skull')); + msg.reply(`Alright, ${team ? 'you have left team ' + team + ' and ' : 'you have '}joined the alliance 'Skull'.`); + break; + } + case 'DarkSide' : { + msg.member.addRole(msg.guild.roles.find('name', 'Dark Side')); + msg.reply(`Alright, ${team ? 'you have left team ' + team + ' and ' : 'you have '}joined the alliance 'Dark Side'.`); + break; + } + default : { + msg.reply('You did not pick an existing alliance. The list of alliances are as follows:\nDarkSide, Skull'); + break; + } + } +}; + +function findTeam(msg, team) { + + let oldTeam; + + if (msg.member.roles.find('name', 'Skull')) { + if (team == 'skull') return; + msg.member.removeRole(msg.guild.roles.find('name', 'Skull')); + oldTeam = 'Skull'; + } + else if (msg.member.roles.find('name', 'Dark Side')) { + if (team == 'DarkSide') return; + msg.member.removeRole(msg.guild.roles.find('name', 'DarkSide')); + oldTeam = 'DarkSide'; + } + return oldTeam; +} + +exports.conf = { + aliases: ['pick', 'choose'], + guildOnly: true, +}; + +exports.help = { + name: 'joinalliance', + description: 'Join one of the alliances!', + usage: '', +}; diff --git a/commands/Pokemon/leave.js b/commands/Pokemon/leave.js deleted file mode 100644 index 813debe..0000000 --- a/commands/Pokemon/leave.js +++ /dev/null @@ -1,35 +0,0 @@ -/** ************************************** - * - * Leave: Plugin for PokeBot that powers the PokeWorld team system. - * Copyright (C) 2018 TheEdge, jtsshieh, Alee - * - * Licensed under the Open Software License version 3.0 - * - * *************************************/ - -exports.run = async (bot, msg) => { - const isWhitelist = await bot.plugins.whitelist.isWhitelist(msg.guild.id); - if (!isWhitelist) return msg.reply ('This is a Whiltelisted command. Only whitelisted servers can use this command. Sorry!'); - - if (msg.member.roles.find('name', 'Skull')) { - msg.member.removeRole(msg.guild.roles.find('name', 'Skull')); - msg.reply('Alright, you are not longer in team Skull.'); - } - else if (msg.member.roles.find('name', 'Flare')) { - msg.member.removeRole(msg.guild.roles.find('name', 'Flare')); - msg.reply('Alright, you are not longer in team Flare.'); - } - else { - msg.reply('You are not in a team.'); - } -}; - -exports.conf = { - aliases: [], - guildOnly: true, -}; - -exports.help = { - name: 'leave', - description: 'Leave the team you currently are in.', -}; diff --git a/commands/Pokemon/leavealliance.js b/commands/Pokemon/leavealliance.js new file mode 100644 index 0000000..4d31286 --- /dev/null +++ b/commands/Pokemon/leavealliance.js @@ -0,0 +1,35 @@ +/** ************************************** + * + * Leave: Plugin for PokeBot that powers the PokeWorld team system. + * Copyright (C) 2018 TheEdge, jtsshieh, Alee + * + * Licensed under the Open Software License version 3.0 + * + * *************************************/ + +exports.run = async (bot, msg) => { + const isWhitelist = await bot.plugins.whitelist.isWhitelist(msg.guild.id); + if (!isWhitelist) return msg.reply ('This is a Whiltelisted command. Only whitelisted servers can use this command. Sorry!'); + + if (msg.member.roles.find('name', 'Skull')) { + msg.member.removeRole(msg.guild.roles.find('name', 'Skull')); + msg.reply('Alright, you are not longer in the alliance `Skull`.'); + } + else if (msg.member.roles.find('name', 'Dark Side')) { + msg.member.removeRole(msg.guild.roles.find('name', 'Dark Side')); + msg.reply('Alright, you are not longer in the alliance `Dark Side`.'); + } + else { + msg.reply('You are not in a team.'); + } +}; + +exports.conf = { + aliases: [], + guildOnly: true, +}; + +exports.help = { + name: 'leave', + description: 'Leave the alliance you currently are in.', +}; diff --git a/events/guildMemberAdd.js b/events/guildMemberAdd.js index c24ac57..9c901a8 100644 --- a/events/guildMemberAdd.js +++ b/events/guildMemberAdd.js @@ -36,7 +36,7 @@ module.exports = async (bot, member) => { bot.channels.get('426829685289123850').setName('Member Count: ' + (member.guild.memberCount - botCount)); bot.channels.get('426829838238613504').setName('Bot Count: ' + botCount); bot.channels.get('417100669980508160').send(`Welcome to the server **${member.user.tag}**! Make sure to read the rules! We now have ${member.guild.memberCount} members.`); - bot.channels.get('417088992329334794').send('Welcome to the server <@' + member.id + '>. Be sure to join a team: `p:join `. Also, make sure to read our introduction: `p:start`.'); + bot.channels.get('417088992329334794').send('Welcome to the server <@' + member.id + '>. Be sure to join an alliance! To see current alliances, run the command `p:join`. Thanks for visiting, and we hope you enjoy your stay.'); const role = member.guild.roles.find('name', 'Trainers'); member.addRole(role); }; -- cgit v1.2.3