/[sudobot]/trunk/src/commands/moderation/HistoryCommand.ts
ViewVC logotype

Diff of /trunk/src/commands/moderation/HistoryCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 105 by rakin, Mon Jul 29 17:28:37 2024 UTC revision 197 by rakin, Mon Jul 29 17:28:59 2024 UTC
# Line 1  Line 1 
1  import { BanOptions, CommandInteraction, EmojiIdentifierResolvable, GuildMember, Interaction, InteractionCollector, Message, MessageActionRow, MessageButton, MessageOptions, ReplyOptions, TextChannel, User } from 'discord.js';  import { BanOptions, CommandInteraction, ContextMenuInteraction, EmojiIdentifierResolvable, GuildMember, Interaction, InteractionCollector, Message, MessageActionRow, MessageButton, MessageOptions, ReplyOptions, TextChannel, User } from 'discord.js';
2  import BaseCommand from '../../utils/structures/BaseCommand';  import BaseCommand from '../../utils/structures/BaseCommand';
3  import DiscordClient from '../../client/Client';  import DiscordClient from '../../client/Client';
4  import CommandOptions from '../../types/CommandOptions';  import CommandOptions from '../../types/CommandOptions';
# Line 13  import PunishmentType from '../../types/ Line 13  import PunishmentType from '../../types/
13    
14  export default class HistoryCommand extends BaseCommand {  export default class HistoryCommand extends BaseCommand {
15      supportsInteractions: boolean = true;      supportsInteractions: boolean = true;
16        supportsContextMenu = true;
17    
18      constructor() {      constructor() {
19          super('history', 'moderation', []);          super('history', 'moderation', ['Moderation History']);
20      }      }
21    
22      async genEmbed(client: DiscordClient, msg: Message | Interaction, user: User, page: number = 1) {      async genEmbed(client: DiscordClient, msg: Message | Interaction, user: User, page: number = 1) {
# Line 41  export default class HistoryCommand exte Line 42  export default class HistoryCommand exte
42              switch (type) {              switch (type) {
43                  case PunishmentType.BAN:                  case PunishmentType.BAN:
44                      return 'Ban';                      return 'Ban';
45                  case PunishmentType.BEAN:                  case PunishmentType.SOFTBAN:
46                      return 'Bean';                      return 'Soft Ban';
47                    case PunishmentType.TEMPBAN:
48                        return 'Temporary Ban';
49                    case PunishmentType.SHOT:
50                        return 'Shot';
51                  case PunishmentType.MUTE:                  case PunishmentType.MUTE:
52                      return 'Mute';                      return 'Mute';
53                    case PunishmentType.HARDMUTE:
54                        return 'Hardmute';
55                  case PunishmentType.KICK:                  case PunishmentType.KICK:
56                      return 'Kick';                      return 'Kick';
57                  case PunishmentType.WARNING:                  case PunishmentType.WARNING:
# Line 253  export default class HistoryCommand exte Line 260  export default class HistoryCommand exte
260    
261          collector.on('end', async () => {          collector.on('end', async () => {
262              try {              try {
263                  await message.edit({                  if (msg instanceof ContextMenuInteraction) {
264                      components: []                      await msg.editReply({
265                  });                          components: []
266                        });
267                    }
268                    else {
269                        await message.edit({
270                            components: []
271                        });
272                    }
273              }              }
274              catch (e) {              catch (e) {
275                  console.log(e);                                  console.log(e);                
276              }              }
277          });          });
278      }      }
 }  
279    }

Legend:
Removed from v.105  
changed lines
  Added in v.197

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26