diff options
| author | Unknown <jtsshieh@outlook.com> | 2018-03-30 21:13:41 -0400 |
|---|---|---|
| committer | Unknown <jtsshieh@outlook.com> | 2018-03-30 21:13:41 -0400 |
| commit | d330bbf25a7a9bb48eaef4f717ce243e065f85b8 (patch) | |
| tree | 2c808bb071e547bc26900aee349f880cf80822ed | |
| parent | 2622255cd43f787c37951cbc9b70168b433f32ad (diff) | |
| download | PokeBot-d330bbf25a7a9bb48eaef4f717ce243e065f85b8.tar.gz PokeBot-d330bbf25a7a9bb48eaef4f717ce243e065f85b8.tar.bz2 PokeBot-d330bbf25a7a9bb48eaef4f717ce243e065f85b8.zip | |
whitelist
| -rw-r--r-- | Plugins/whitelist.js | 39 | ||||
| -rw-r--r-- | commands/Pokemon/claim.js | 3 | ||||
| -rw-r--r-- | commands/Pokemon/drop.js | 3 | ||||
| -rw-r--r-- | commands/Pokemon/forcedrop.js | 5 | ||||
| -rw-r--r-- | commands/Pokemon/join.js | 3 | ||||
| -rw-r--r-- | commands/Pokemon/leave.js | 3 | ||||
| -rw-r--r-- | commands/Pokemon/tradegym.js | 3 |
7 files changed, 52 insertions, 7 deletions
diff --git a/Plugins/whitelist.js b/Plugins/whitelist.js new file mode 100644 index 0000000..4c7dd8b --- /dev/null +++ b/Plugins/whitelist.js @@ -0,0 +1,39 @@ +/** ************************************** + * + * Whittelist: Plugin for PokeBot that let's the owners whitelist servers. + * Copyright (C) 2018 TheEdge, jtsshieh, Alee + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * *************************************/ + +const db = require('quick.db'); +exports.whitelist = async (guildID) => { + await db.set(`whitelist_${guildID}`, true); +}; + +exports.unwhitelist = async (guildID) => { + await db.set(`whitelist_${guildID}`, false); +}; + +exports.checkWhitelist = async (guildID) => { + const value = await db.fetch(`whitelist_${guildID}`); + if (value) { + return value; + } + else { + await db.set(`whitelist_${guildID}`, false); + return await db.fetch(`whitelist_${guildID}`); + } +}; diff --git a/commands/Pokemon/claim.js b/commands/Pokemon/claim.js index c91b20e..3f9ba6c 100644 --- a/commands/Pokemon/claim.js +++ b/commands/Pokemon/claim.js @@ -19,7 +19,8 @@ * *************************************/ exports.run = async (bot, msg) => { - if (msg.guild.id != '417088992329334792') return msg.reply ('This is a PokeWorld exclusive command. Sorry!'); + const isWhitelist = await bot.plugins.isWhitelist(msg.guild.id); + if (isWhitelist) return msg.reply ('This is a Whiltelisted command. Get your server whitelisted by joining our server at https://discord.me/thedigitalregion and asking in the general channel. Sorry!'); if (!msg.channel.name.startsWith('gym-')) return msg.reply('Go into one of the gym channels and try again.'); if (msg.channel.topic == 'Current Owner: *none*') { let team; diff --git a/commands/Pokemon/drop.js b/commands/Pokemon/drop.js index 1746898..a6ff953 100644 --- a/commands/Pokemon/drop.js +++ b/commands/Pokemon/drop.js @@ -19,7 +19,8 @@ * *************************************/ exports.run = async (bot, msg) => { - if (msg.guild.id != '417088992329334792') return msg.reply ('This is a PokeWorld exclusive command. Sorry!'); + const isWhitelist = await bot.plugins.isWhitelist(msg.guild.id); + if (isWhitelist) return msg.reply ('This is a Whiltelisted command. Get your server whitelisted by joining our server at https://discord.me/thedigitalregion and asking in the general channel. Sorry!'); if (!msg.channel.name.startsWith('gym-')) return msg.reply('Go into one of the gym channels and try again.'); if (msg.channel.topic == 'Current Owner: *none*') { msg.reply('There is no owner for this gym. Claim it now with p:claim!'); diff --git a/commands/Pokemon/forcedrop.js b/commands/Pokemon/forcedrop.js index 2f68759..da06f5d 100644 --- a/commands/Pokemon/forcedrop.js +++ b/commands/Pokemon/forcedrop.js @@ -19,8 +19,9 @@ * *************************************/ exports.run = async (bot, msg) => { - if (msg.guild.id != '417088992329334792') return msg.reply ('This is a PokeWorld exclusive command. Sorry!'); - + const isWhitelist = await bot.plugins.isWhitelist(msg.guild.id); + if (isWhitelist) return msg.reply ('This is a Whiltelisted command. Get your server whitelisted by joining our server at https://discord.me/thedigitalregion and asking in the general channel. Sorry!'); + if (!msg.member.hasPermission('MANAGE_MESSAGES')) return msg.reply('You don\'t have permssion to ban members.'); if (!msg.channel.name.startsWith('gym-')) return msg.reply('Go into one of the gym channels and try again.'); if (msg.channel.topic == 'Current Owner: *none*') { diff --git a/commands/Pokemon/join.js b/commands/Pokemon/join.js index 506fabb..bae820a 100644 --- a/commands/Pokemon/join.js +++ b/commands/Pokemon/join.js @@ -19,7 +19,8 @@ * *************************************/ exports.run = async (bot, msg, args) => { - if (msg.guild.id != '417088992329334792') return msg.reply ('This is a PokeWorld exclusive command. Sorry!'); + const isWhitelist = await bot.plugins.isWhitelist(msg.guild.id); + if (isWhitelist) return msg.reply ('This is a Whiltelisted command. Get your server whitelisted by joining our server at https://discord.me/thedigitalregion and asking in the general channel. Sorry!'); if (args.length < 1) return msg.reply('Please choose a team to join'); diff --git a/commands/Pokemon/leave.js b/commands/Pokemon/leave.js index 13ba141..5682d8e 100644 --- a/commands/Pokemon/leave.js +++ b/commands/Pokemon/leave.js @@ -19,7 +19,8 @@ * *************************************/ exports.run = async (bot, msg) => { - if (msg.guild.id != '417088992329334792') return msg.reply ('This is a PokeWorld exclusive command. Sorry!'); + const isWhitelist = await bot.plugins.isWhitelist(msg.guild.id); + if (isWhitelist) return msg.reply ('This is a Whiltelisted command. Get your server whitelisted by joining our server at https://discord.me/thedigitalregion and asking in the general channel. Sorry!'); if (msg.member.roles.find('name', 'Skull')) { msg.member.removeRole(msg.guild.roles.find('name', 'Skull')); diff --git a/commands/Pokemon/tradegym.js b/commands/Pokemon/tradegym.js index b9d590b..fd08147 100644 --- a/commands/Pokemon/tradegym.js +++ b/commands/Pokemon/tradegym.js @@ -19,7 +19,8 @@ * *************************************/ exports.run = async (bot, msg) => { - if (msg.guild.id != '417088992329334792') return msg.reply ('This is a PokeWorld exclusive command. Sorry!'); + const isWhitelist = await bot.plugins.isWhitelist(msg.guild.id); + if (isWhitelist) return msg.reply ('This is a Whiltelisted command. Get your server whitelisted by joining our server at https://discord.me/thedigitalregion and asking in the general channel. Sorry!'); if (!msg.channel.name.startsWith('gym-')) return msg.reply('Go into one of the gym channels and try again.'); let team; |
