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/commands/fun/say.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/commands/fun') 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 -- cgit v1.2.3