Skip to content

Commit

Permalink
Merge pull request #756 from ViBotTeam/husky/fix-unsuspend-no-row
Browse files Browse the repository at this point in the history
Husky/fix unsuspend no row
  • Loading branch information
Ragviswa authored Feb 23, 2024
2 parents 1eea9bf + 3476603 commit f84eacf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions commands/unsuspend.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,21 @@ module.exports = {
return;
}

embed.setDescription(`${member} was not suspended by ${bot.user}. Would you still like to unsuspend them? They will receive the <@&${settings.roles.raider}> role back.`);
if (!member.nickname) embed.addFields({ name: 'No Nickname Warning', value: `${member} does not have a nickname. Make sure they are supposed to receive <@&${settings.roles.raider}> before continuing.` });
const receivedRole = member.nickname || !settings.roles.unverified || !settings.backend.useUnverifiedRole ? settings.roles.raider : settings.roles.unverified;
embed.setDescription(`${member} was not suspended by ${bot.user}. Would you still like to unsuspend them?`);
if (!member.nickname) embed.addFields({ name: 'No Nickname Warning', value: `${member} does not have a nickname, they will be given the <@&${receivedRole}> role instead of <@&${settings.roles.raider}>.` });
embed.addFields({ name: 'Reason', value: reason });
confirmMessage.edit({ embeds: [embed] });

if (await confirmMessage.confirmButton(message.member.id)) {
member.roles.remove([settings.roles.tempsuspended, settings.roles.permasuspend])
.then(() => member.roles.add(settings.roles.raider))
.then(() => settings.backend.useUnverifiedRole && member.roles.cache.has(settings.roles.unverified) && member.roles.remove(settings.roles.unverified));

await member.roles.remove([settings.roles.tempsuspended, settings.roles.permasuspended].filter(r => r));
await member.roles.add(receivedRole).then(() => settings.backend.useUnverifiedRole && settings.roles.unverified && receivedRole == settings.roles.raider && member.roles.remove(settings.roles.unverified));
embed.setTitle('Unsuspended')
.setDescription(`${member} has been unsuspended.`)
.setColor(Discord.Colors.Green)
.setFields({ name: 'Member Information', value: `${member} \`${member.displayName}\``, inline: true },
{ name: 'Mod Information', value: `${message.member} \`${message.member.displayName}\``, inline: true },
{ name: 'Roles Received', value: `<@&${settings.roles.raider}>`, inline: true },
{ name: 'Roles Received', value: `<@&${receivedRole}>`, inline: true },
...embed.data.fields)
.setTimestamp(Date.now())
.setFooter({ text: 'Unsuspended at' });
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vibot",
"version": "8.16.4",
"version": "8.16.5",
"description": "ViBot",
"main": "index.js",
"dependencies": {
Expand Down

0 comments on commit f84eacf

Please sign in to comment.