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

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

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

revision 106 by rakin, Mon Jul 29 17:28:37 2024 UTC revision 194 by rakin, Mon Jul 29 17:28:58 2024 UTC
# Line 9  import History from '../../automod/Histo Line 9  import History from '../../automod/Histo
9  import Punishment from '../../models/Punishment';  import Punishment from '../../models/Punishment';
10  import PunishmentType from '../../types/PunishmentType';  import PunishmentType from '../../types/PunishmentType';
11  import { fetchEmojiStr } from '../../utils/Emoji';  import { fetchEmojiStr } from '../../utils/Emoji';
12    import { hasPermission, shouldNotModerate } from '../../utils/util';
13    
14  export default class SoftBanCommand extends BaseCommand {  export default class SoftBanCommand extends BaseCommand {
15      supportsInteractions: boolean = true;      supportsInteractions: boolean = true;
# Line 124  export default class SoftBanCommand exte Line 125  export default class SoftBanCommand exte
125              reply = <Message> await msg.fetchReply();              reply = <Message> await msg.fetchReply();
126    
127          try {          try {
128                try {
129                    const member = await msg.guild!.members.fetch(user.id);
130    
131                    if (member && !(await hasPermission(client, member, msg, null, "You don't have permission to softban this user."))) {
132                        return;
133                    }
134    
135                    if (member && shouldNotModerate(client, member)) {
136                        await msg.reply({
137                            embeds: [
138                                new MessageEmbed()
139                                .setColor('#f14a60')
140                                .setDescription('This user cannot be softbanned.')
141                            ]
142                        });
143    
144                        return;
145                    }
146                }
147                catch (e) {
148                    console.log(e);
149                }
150                
151              await msg.guild?.bans.create(user, banOptions);              await msg.guild?.bans.create(user, banOptions);
152              await new Promise(r => setTimeout(r, 1600));              await new Promise(r => setTimeout(r, 1600));
153              await msg.guild?.bans.remove(user);              await msg.guild?.bans.remove(user);
# Line 176  export default class SoftBanCommand exte Line 200  export default class SoftBanCommand exte
200              return;              return;
201          }          }
202      }      }
 }  
203    }

Legend:
Removed from v.106  
changed lines
  Added in v.194

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26