aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/admin/prefix.ts8
-rw-r--r--src/commands/moderation/ban.ts26
-rw-r--r--src/commands/moderation/kick.ts18
-rw-r--r--src/commands/moderation/modlog.ts7
-rw-r--r--src/commands/moderation/warn.ts18
5 files changed, 68 insertions, 9 deletions
diff --git a/src/commands/admin/prefix.ts b/src/commands/admin/prefix.ts
index 8fb50f8..3948a7e 100644
--- a/src/commands/admin/prefix.ts
+++ b/src/commands/admin/prefix.ts
@@ -10,7 +10,13 @@ export default class PrefixCommand extends BotCommand {
id: 'prefix'
}
],
- userPermissions: ['MANAGE_GUILD']
+ userPermissions: ['MANAGE_GUILD'],
+ description: {
+ content:
+ 'Set the prefix of the current server (resets to default if prefix is not given)',
+ usage: 'prefix [prefix]',
+ examples: ['prefix', 'prefix +']
+ }
});
}
async exec(
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index fc861dc..7ce36d3 100644
--- a/src/commands/moderation/ban.ts
+++ b/src/commands/moderation/ban.ts
@@ -1,4 +1,5 @@
import { User } from 'discord.js';
+import { Guild } from '../../lib/models';
import { BotCommand } from '../../lib/extensions/BotCommand';
import { BotMessage } from '../../lib/extensions/BotMessage';
import { Ban, Modlog, ModlogType } from '../../lib/models';
@@ -27,7 +28,8 @@ export default class PrefixCommand extends BotCommand {
}
},
{
- id: 'reason'
+ id: 'reason',
+ match: 'rest'
},
{
id: 'time',
@@ -36,7 +38,16 @@ export default class PrefixCommand extends BotCommand {
}
],
clientPermissions: ['BAN_MEMBERS'],
- userPermissions: ['BAN_MEMBERS']
+ userPermissions: ['BAN_MEMBERS'],
+ description: {
+ content:
+ 'Ban a member and log it in modlogs (with optional time to unban)',
+ usage: 'ban <member> <reason> [--time]',
+ examples: [
+ 'ban @Tyman being cool',
+ 'ban @Tyman being cool --time 7days'
+ ]
+ }
});
}
async exec(
@@ -47,6 +58,15 @@ export default class PrefixCommand extends BotCommand {
let modlogEnry: Modlog;
let banEntry: Ban;
const translatedTime: string[] = [];
+ // 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 {
try {
if (time) {
@@ -129,8 +149,8 @@ export default class PrefixCommand extends BotCommand {
);
} catch {
await message.util.send('Error banning :/');
- await modlogEnry.destroy();
await banEntry.destroy();
+ await modlogEnry.destroy();
return;
}
}
diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts
index dcd19de..23fc092 100644
--- a/src/commands/moderation/kick.ts
+++ b/src/commands/moderation/kick.ts
@@ -1,6 +1,6 @@
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';
import { GuildMember } from 'discord.js';
export default class PrefixCommand extends BotCommand {
@@ -21,7 +21,12 @@ export default class PrefixCommand extends BotCommand {
}
],
clientPermissions: ['KICK_MEMBERS'],
- userPermissions: ['KICK_MEMBERS']
+ userPermissions: ['KICK_MEMBERS'],
+ description: {
+ content: 'Kick a member and log it in modlogs',
+ usage: 'kick <member> <reason>',
+ examples: ['kick @Tyman being cool']
+ }
});
}
async exec(
@@ -29,6 +34,15 @@ export default class PrefixCommand extends BotCommand {
{ user, reason }: { user: GuildMember; reason?: string }
): Promise<void> {
let modlogEnry: Modlog;
+ // 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 {
modlogEnry = Modlog.build({
user: user.id,
diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts
index dbb101c..320c6b4 100644
--- a/src/commands/moderation/modlog.ts
+++ b/src/commands/moderation/modlog.ts
@@ -22,7 +22,12 @@ export default class ModlogCommand extends BotCommand {
type: 'number'
}
],
- userPermissions: ['MANAGE_MESSAGES']
+ userPermissions: ['MANAGE_MESSAGES'],
+ description: {
+ content: "View a user's modlogs, or view a specific modlog entry",
+ usage: 'warn <search> [page]',
+ examples: ['modlogs @Tyman', 'modlogs @Tyman 3']
+ }
});
}
*args(): unknown {
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,