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

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

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

revision 153 by rakin, Mon Jul 29 17:28:48 2024 UTC revision 205 by rakin, Mon Jul 29 17:29:00 2024 UTC
# Line 1  Line 1 
1  import { BanOptions, CommandInteraction, GuildMember, Interaction, Message, User } from 'discord.js';  import { BanOptions, CommandInteraction, GuildMember, Interaction, Message, User, Permissions } 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 11  import PunishmentType from '../../types/ Line 11  import PunishmentType from '../../types/
11  import { fetchEmojiStr } from '../../utils/Emoji';  import { fetchEmojiStr } from '../../utils/Emoji';
12  import ms from 'ms';  import ms from 'ms';
13  import { clearTimeoutv2, getTimeouts, setTimeoutv2 } from '../../utils/setTimeout';  import { clearTimeoutv2, getTimeouts, setTimeoutv2 } from '../../utils/setTimeout';
14  import { shouldNotModerate } from '../../utils/util';  import { hasPermission, shouldNotModerate } from '../../utils/util';
15    
16  export default class tempBanCommand extends BaseCommand {  export default class TempBanCommand extends BaseCommand {
17      supportsInteractions: boolean = true;      supportsInteractions: boolean = true;
18        permissions = [Permissions.FLAGS.BAN_MEMBERS];
19    
20      constructor() {      constructor() {
21          super('tempban', 'moderation', []);          super('tempban', 'moderation', []);
# Line 136  export default class tempBanCommand exte Line 137  export default class tempBanCommand exte
137              try {              try {
138                  const member = await msg.guild?.members.fetch(user.id);                  const member = await msg.guild?.members.fetch(user.id);
139    
140                    if (member && !(await hasPermission(client, member, msg, null, "You don't have permission to tempban this user."))) {
141                        return;
142                    }
143    
144                  if (member && shouldNotModerate(client, member)) {                  if (member && shouldNotModerate(client, member)) {
145                      await msg.reply({                      await msg.reply({
146                          embeds: [                          embeds: [
# Line 150  export default class tempBanCommand exte Line 155  export default class tempBanCommand exte
155              }              }
156              catch (e) {              catch (e) {
157                  console.log(e);                  console.log(e);
                 return;  
158              }              }
159                    
160              await msg.guild?.bans.create(user, banOptions);              await msg.guild?.bans.create(user, banOptions);

Legend:
Removed from v.153  
changed lines
  Added in v.205

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26