Skip to content

Commit

Permalink
chore: Update bulkunban command to handle errors during unbanning
Browse files Browse the repository at this point in the history
  • Loading branch information
juddisjudd committed Jun 3, 2024
1 parent e8e4a6a commit e2c782d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/commands/moderation/bulkunban.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,22 @@ const BulkUnban: Command = {
const unbans = bans.filter((ban) => ban.reason && ban.reason.toLowerCase().includes(reasonOption.toLowerCase()));
logger.info(`Matching bans found: ${unbans.size}`); // <-- Log matched bans

await interaction.reply(`Starting to unban ${unbans.size} users. This might take a while...`);

for (const ban of unbans.values()) {
logger.info(`Attempting to unban: ${ban.user.tag} - Reason: ${ban.reason}`); // <-- Log each user being unbanned
await interaction.guild.bans.remove(ban.user, `Used /bulkunban for reason: ${reasonOption}`);
amount++;
}

await interaction.reply(`Successfully unbanned ${amount} users.`);
await interaction.followUp(`Successfully unbanned ${amount} users.`);
} catch (e) {
await interaction.reply('An error occurred while processing the unbans.');
logger.error(e);
if (interaction.replied || interaction.deferred) {
await interaction.followUp('An error occurred while processing the unbans.');
} else {
await interaction.reply('An error occurred while processing the unbans.');
}
}
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/events/onMemberJoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const onMemberJoin = async (member: GuildMember) => {
const channel = member.guild.channels.cache.get(member_activity_channel) as TextChannel;
if (!channel) return;

const welcomeMessage = `Welcome <@${member.id}> to the server!`;
const welcomeMessage = `Welcome ${member.id} to the server!`;
channel.send(welcomeMessage);

const roleId = '842455998266605610'; // Overextended Member RoleID
Expand Down

0 comments on commit e2c782d

Please sign in to comment.