aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation/modlog.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/moderation/modlog.ts')
-rw-r--r--src/commands/moderation/modlog.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts
index 443ffa3..c089d40 100644
--- a/src/commands/moderation/modlog.ts
+++ b/src/commands/moderation/modlog.ts
@@ -1,4 +1,5 @@
import { BushCommand, ButtonPaginator, ModLog, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import assert from 'assert';
import { ApplicationCommandOptionType, Embed, PermissionFlagsBits, User } from 'discord.js';
export default class ModlogCommand extends BushCommand {
@@ -30,6 +31,7 @@ export default class ModlogCommand extends BushCommand {
}
],
slash: true,
+ channel: 'guild',
clientPermissions: (m) => util.clientSendAndPermCheck(m),
userPermissions: (m) => util.userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages])
});
@@ -39,11 +41,13 @@ export default class ModlogCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
{ search, hidden }: { search: ArgType<'user'> | string; hidden: boolean }
) {
+ assert(message.inGuild());
+
const foundUser = search instanceof User ? search : await util.resolveUserAsync(search);
if (foundUser) {
const logs = await ModLog.findAll({
where: {
- guild: message.guild!.id,
+ guild: message.guild.id,
user: foundUser.id
},
order: [['createdAt', 'ASC']]
@@ -68,8 +72,7 @@ export default class ModlogCommand extends BushCommand {
const entry = await ModLog.findByPk(search as string);
if (!entry || entry.pseudo || (entry.hidden && !hidden))
return message.util.send(`${util.emojis.error} That modlog does not exist.`);
- if (entry.guild !== message.guild!.id)
- return message.util.reply(`${util.emojis.error} This modlog is from another server.`);
+ if (entry.guild !== message.guild.id) return message.util.reply(`${util.emojis.error} This modlog is from another server.`);
const embed = {
title: `Case ${entry.id}`,
description: ModlogCommand.generateModlogInfo(entry, true),