aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation/WarnCommand.ts
diff options
context:
space:
mode:
authorTymanWasTaken <32660892+tymanwastaken@users.noreply.github.com>2021-05-11 10:52:26 -0600
committerTymanWasTaken <32660892+tymanwastaken@users.noreply.github.com>2021-05-11 10:52:26 -0600
commit199d413119f3656d9f2da118f91a22a3cc55f6bb (patch)
tree7d1ba161a51bb6303e5a537f8043d07cfc325a76 /src/commands/moderation/WarnCommand.ts
parente0b2b559219d642d6b5353490ab60ae1a754b560 (diff)
downloadtanzanite-199d413119f3656d9f2da118f91a22a3cc55f6bb.tar.gz
tanzanite-199d413119f3656d9f2da118f91a22a3cc55f6bb.tar.bz2
tanzanite-199d413119f3656d9f2da118f91a22a3cc55f6bb.zip
whoops forgot about these
Diffstat (limited to 'src/commands/moderation/WarnCommand.ts')
-rw-r--r--src/commands/moderation/WarnCommand.ts54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/commands/moderation/WarnCommand.ts b/src/commands/moderation/WarnCommand.ts
deleted file mode 100644
index 676615d..0000000
--- a/src/commands/moderation/WarnCommand.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-import { GuildMember } from 'discord.js';
-import { BotCommand } from '../../lib/extensions/BotCommand';
-import { BotMessage } from '../../lib/extensions/BotMessage';
-import { Modlog, ModlogType } from '../../lib/types/Models';
-
-export default class WarnCommand extends BotCommand {
- public constructor() {
- super('warn', {
- aliases: ['warn'],
- userPermissions: ['MANAGE_MESSAGES'],
- args: [
- {
- id: 'member',
- type: 'member'
- },
- {
- id: 'reason',
- match: 'rest'
- }
- ]
- });
- }
- public async exec(
- message: BotMessage,
- { member, reason }: { member: GuildMember; reason: string }
- ): Promise<void> {
- 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}".`
- );
- }
-}