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

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

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

revision 86 by rakin, Mon Jul 29 17:28:32 2024 UTC revision 125 by rakin, Mon Jul 29 17:28:41 2024 UTC
# Line 1  Line 1 
1  import { BanOptions, CommandInteraction, GuildMember, Interaction, Message, User } from 'discord.js';  import { BanOptions, CommandInteraction, ContextMenuInteraction, GuildMember, Interaction, Message, 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 12  import PunishmentType from '../../types/ Line 12  import PunishmentType from '../../types/
12    
13  export default class KickCommand extends BaseCommand {  export default class KickCommand extends BaseCommand {
14      supportsInteractions: boolean = true;      supportsInteractions: boolean = true;
15        supportsContextMenu: boolean = true;
16    
17      constructor() {      constructor() {
18          super('kick', 'moderation', []);          super('kick', 'moderation', ['Kick']);
19      }      }
20    
21      async run(client: DiscordClient, msg: Message | CommandInteraction, options: CommandOptions | InteractionOptions) {      async run(client: DiscordClient, msg: Message | CommandInteraction | ContextMenuInteraction, options: CommandOptions | InteractionOptions) {
22          if (!options.isInteraction && typeof options.args[0] === 'undefined') {          if (!options.isInteraction && typeof options.args[0] === 'undefined') {
23              await msg.reply({              await msg.reply({
24                  embeds: [                  embeds: [
# Line 34  export default class KickCommand extends Line 35  export default class KickCommand extends
35          let reason: string | undefined;          let reason: string | undefined;
36    
37          if (options.isInteraction) {          if (options.isInteraction) {
38              user = await <GuildMember> options.options.getMember('member');              user = await <GuildMember> (msg instanceof ContextMenuInteraction ? options.options.getMember('user') : options.options.getMember('member'));
39    
40              if (!user) {              if (!user) {
41                  await msg.reply({                  await msg.reply({

Legend:
Removed from v.86  
changed lines
  Added in v.125

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26