Skip to content

Commit

Permalink
feat: Add nukecourserep - related #7
Browse files Browse the repository at this point in the history
  • Loading branch information
Ki-er committed Aug 22, 2023
1 parent 4cba258 commit e589752
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/slashCommands/admin/nukecoursereps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');

module.exports = {
...new SlashCommandBuilder()
.setName('nukecourserep')
.setDescription('Replaces course rep')
.setDefaultMemberPermissions(
PermissionFlagsBits.KickMembers || PermissionFlagsBits.BanMembers
),

/**
*
* @param {Client} client
* @param {CommandInteraction} interaction
* @param {String[]} args
*/

run: async (client, interaction) => {
await interaction.deferReply({
ephemeral: true,
});

try {
const role = interaction.guild.roles.cache.find(
(r) => r.name === 'Course Rep'
);

interaction.guild.roles.create({
name: role.name,
color: role.color,
hoist: role.hoist,
position: role.position,
permissions: role.permissions,
mentionable: role.mentionable,
});

role.delete(role.id, 'The Nuke Course Rep Command Was Run. ');

const newRole = interaction.guild.roles.cache.find(
(r) => r.name === 'Course Rep'
);
interaction.editReply(
`Role has been replaced. The new role ID is: ${newRole.id}. Please pass this to Kieran.`,
true
);
} catch (error) {
interaction.editReply({
content: error,
ephemeral: true,
});
}
},
};

0 comments on commit e589752

Please sign in to comment.