aboutsummaryrefslogtreecommitdiff
path: root/src/context-menu-commands/user/modlog.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-05-24 22:02:06 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-05-24 22:02:06 -0400
commitb6978b20725efbdb83d4341f15ac250ede28c012 (patch)
tree599b45aacf5bebf1fef9252c1bfea3d797e47a91 /src/context-menu-commands/user/modlog.ts
parenta8d2c867ca35ea23d63123136e88730065ec9568 (diff)
downloadtanzanite-b6978b20725efbdb83d4341f15ac250ede28c012.tar.gz
tanzanite-b6978b20725efbdb83d4341f15ac250ede28c012.tar.bz2
tanzanite-b6978b20725efbdb83d4341f15ac250ede28c012.zip
feat: ModlogContextMenuCommand
Diffstat (limited to 'src/context-menu-commands/user/modlog.ts')
-rw-r--r--src/context-menu-commands/user/modlog.ts34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/context-menu-commands/user/modlog.ts b/src/context-menu-commands/user/modlog.ts
new file mode 100644
index 0000000..09d9a61
--- /dev/null
+++ b/src/context-menu-commands/user/modlog.ts
@@ -0,0 +1,34 @@
+import { ModlogCommand } from '#commands';
+import { BushCommandUtil, BushSlashMessage } from '#lib';
+import { ContextMenuCommand } from 'discord-akairo';
+import { ApplicationCommandType, type ContextMenuCommandInteraction } from 'discord.js';
+
+export default class ModlogContextMenuCommand extends ContextMenuCommand {
+ public constructor() {
+ super('modlog', {
+ name: "Users's Modlogs",
+ type: ApplicationCommandType.User,
+ category: 'user',
+ guilds: ['516977525906341928']
+ });
+ }
+
+ public override async exec(interaction: ContextMenuCommandInteraction) {
+ if (!interaction.inCachedGuild())
+ return interaction.reply({
+ content: `${util.emojis.error} You can't use this command outside of a server.`,
+ ephemeral: true
+ });
+ if (!interaction.member?.permissions.has('ManageMessages'))
+ return interaction.reply({
+ content: `${util.emojis.error} You can't use this command because you have the **Manage Messages** permission.`,
+ ephemeral: true
+ });
+
+ await interaction.deferReply({ ephemeral: true });
+ const pseudoMessage = new BushSlashMessage(client, interaction as any);
+ pseudoMessage.util = new BushCommandUtil(client.commandHandler, pseudoMessage);
+
+ void new ModlogCommand().exec(pseudoMessage, { search: interaction.targetId, hidden: false });
+ }
+}