aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation/warn.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/moderation/warn.ts')
-rw-r--r--src/commands/moderation/warn.ts18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts
index 755a036..98ba4bd 100644
--- a/src/commands/moderation/warn.ts
+++ b/src/commands/moderation/warn.ts
@@ -1,7 +1,7 @@
import { GuildMember } from 'discord.js';
import { BotCommand } from '../../lib/extensions/BotCommand';
import { BotMessage } from '../../lib/extensions/BotMessage';
-import { Modlog, ModlogType } from '../../lib/models';
+import { Guild, Modlog, ModlogType } from '../../lib/models';
export default class WarnCommand extends BotCommand {
public constructor() {
@@ -17,13 +17,27 @@ export default class WarnCommand extends BotCommand {
id: 'reason',
match: 'rest'
}
- ]
+ ],
+ description: {
+ content: 'Warn a member and log it in modlogs',
+ usage: 'warn <member> <reason>',
+ examples: ['warn @Tyman being cool']
+ }
});
}
public async exec(
message: BotMessage,
{ member, reason }: { member: GuildMember; reason: string }
): Promise<void> {
+ // 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,