From cd0f853a2e4732cea5356f9ee3603bb804b0ab1f Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Wed, 26 May 2021 21:53:35 -0400 Subject: made some more changes --- src/commands/moderation/warn.ts | 67 ----------------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 src/commands/moderation/warn.ts (limited to 'src/commands/moderation/warn.ts') diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts deleted file mode 100644 index e8b1401..0000000 --- a/src/commands/moderation/warn.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { GuildMember, Message } from 'discord.js'; -import { BushCommand } from '../../lib/extensions/BushCommand'; -import { Guild, Modlog, ModlogType } from '../../lib/models'; - -export default class WarnCommand extends BushCommand { - public constructor() { - super('warn', { - aliases: ['warn'], - userPermissions: ['MANAGE_MESSAGES'], - args: [ - { - id: 'member', - type: 'member' - }, - { - id: 'reason', - match: 'rest' - } - ], - description: { - content: 'Warn a member and log it in modlogs', - usage: 'warn ', - examples: ['warn @Tyman being cool'] - } - }); - } - public async exec( - message: Message, - { member, reason }: { member: GuildMember; reason: string } - ): Promise { - // Create guild entry so postgres doesn't get mad when I try and add a modlog entry - await Guild.findOrCreate({ - where: { - id: message.guild.id - }, - defaults: { - id: message.guild.id - } - }); - try { - const entry = Modlog.build({ - user: member.id, - guild: message.guild.id, - moderator: message.author.id, - type: ModlogType.WARN, - reason - }); - await entry.save(); - } catch (e) { - await message.util.send( - 'Error saving to database, please contact the developers' - ); - return; - } - try { - await member.send( - `You were warned in ${message.guild.name} for reason "${reason}".` - ); - } catch (e) { - await message.util.send('Error messaging user, warning still saved.'); - return; - } - await message.util.send( - `${member.user.tag} was warned for reason "${reason}".` - ); - } -} -- cgit