From 8c0d89ba7f9e983f35ab6576d798ae0384b6ebab Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Thu, 16 Jul 2020 21:21:38 -0700 Subject: add more perms --- src/bot.ts | 5 ++++- src/commands/fun/say.ts | 17 +++++++++++++---- src/commands/server/poll.ts | 42 ++++++++++++++++++++++++------------------ src/config.json | 9 +++++++-- 4 files changed, 48 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/bot.ts b/src/bot.ts index e4635f8..9ce71ad 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -190,7 +190,10 @@ client.on('message', async msg => { // If a message is in Kat's Korner and it mentions the word water, react with LizardsWater emoji. if (msg.guild?.id == '663964105983393793') - if (msg.content.toLowerCase().includes("water")) msg.react('731022085530583100') + if (msg.content.toLowerCase().includes("water")) { + msg.react('731022085530583100') + msg.react('732062891162992720') + } }); // Register client diff --git a/src/commands/fun/say.ts b/src/commands/fun/say.ts index e10aff8..985307a 100644 --- a/src/commands/fun/say.ts +++ b/src/commands/fun/say.ts @@ -1,6 +1,7 @@ import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; //@ts-ignore import * as emoji from 'emoji-random' +import * as config from '../../config.json' module.exports = class SayFun extends Command { constructor(client: CommandoClient) { @@ -25,12 +26,20 @@ module.exports = class SayFun extends Command { clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] }); } + //@ts-ignore run(msg: CommandoMessage, { say }: any) { - if (msg.author.id == '217348698294714370' || msg.guild.member(msg.author.id)?.hasPermission('MANAGE_MESSAGES')) { - msg.say(say) - msg.delete(); + if (config['validUsers'].includes(msg.author.id)) { + if (msg.author.id == '217348698294714370' || msg.guild.member(msg.author.id)?.hasPermission('MANAGE_MESSAGES')) { + msg.say(say) + msg.delete(); + return + } else { + //@ts-ignore + return msg.reply(`Insufficent permissions! ${emoji.random()}`).then(m => m.delete({ timeout: 3000 })) + } } else { - msg.reply(`Insufficent permissions! ${emoji.random()}`); + //@ts-ignore + return msg.reply(`Insufficent permissions! ${emoji.random()}`).then(m => m.delete({ timeout: 3000 })) } } }; \ No newline at end of file diff --git a/src/commands/server/poll.ts b/src/commands/server/poll.ts index 6230f86..7f7d3b0 100644 --- a/src/commands/server/poll.ts +++ b/src/commands/server/poll.ts @@ -2,6 +2,7 @@ import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; //@ts-ignore no types import emoji from 'emoji-random' +import config from '../../config.json' module.exports = class PollServer extends Command { constructor(client: CommandoClient) { @@ -15,32 +16,37 @@ module.exports = class PollServer extends Command { usages: 5, duration: 30 }, - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], guildOnly: true }); } //@ts-ignore this is not async run(msg: CommandoMessage) { - let messageArray = msg.content.split(' ') - let args = messageArray.slice(1) + if (config['validUsers'].includes(msg.author.id)) { + let messageArray = msg.content.split(' ') + let args = messageArray.slice(1) - if (!args || args.length < 1) { - return msg.reply(`No poll content was specified. ${emoji.random()}`) + if (!args || args.length < 1) { + return msg.reply(`No poll content was specified. ${emoji.random()}`) + } else { + let emb = new MessageEmbed() + .setColor(0xFFCC4D) + .setFooter('React to vote.') + .setDescription(args.join(' ')) + .setTitle(`Poll Created by ${msg.author.username} ${emoji.random()}`) + return msg.say(emb).then(fMsg => { + //@ts-ignore yes these exist + fMsg.react('✅') + //@ts-ignore yes these exist + fMsg.react('❎') + //@ts-ignore yes these exist + msg.delete({ timeout: 1000 }) + }) + } } else { - let emb = new MessageEmbed() - .setColor(0xFFCC4D) - .setFooter('React to vote.') - .setDescription(args.join(' ')) - .setTitle(`Poll Created by ${msg.author.username} ${emoji.random()}`) - return msg.say(emb).then(fMsg => { - //@ts-ignore yes these exist - fMsg.react('✅') - //@ts-ignore yes these exist - fMsg.react('❎') - //@ts-ignore yes these exist - msg.delete({ timeout: 1000 }) - }) + //@ts-ignore + return msg.reply(`Insufficent permissions! ${emoji.random()}`).then(m => m.delete({ timeout: 3000 })) } } }; \ No newline at end of file diff --git a/src/config.json b/src/config.json index e64ceaa..672e256 100644 --- a/src/config.json +++ b/src/config.json @@ -2,7 +2,12 @@ "secret":"Njk5NDczMjYzOTk4MjcxNDg5.XpU5oQ.btZuxVudhNllSQY6CxrXXtMJm9A", "secret-dev":"NzEyMDg4MzY5MjA2OTE5MjY5.XsMeEw.Yy0a8m2vZLDbPi7cZ8aqCalMR68", "yt-api-key":"AIzaSyCeG1lQAeInv4vjFv_eTL9IFAFNdQC9Nk8", - "version":"1.10.33", + "version":"1.10.34", "fortniteTrackerNetworkToken": "4cf21f95-5f1a-412a-b4a7-e5424adc314a", - "mongodburi": "mongodb://sin:cSDZEygGZz232eJ5bS@ds047107.mlab.com:47107/heroku_4qrjvmb9" + "mongodburi": "mongodb://sin:cSDZEygGZz232eJ5bS@ds047107.mlab.com:47107/heroku_4qrjvmb9", + "validUsers": [ + "217348698294714370", + "612779586065006641", + "385964717480476684" + ] } -- cgit v1.2.3