Updated required permissions
This commit is contained in:
48
index.js
48
index.js
@ -83,10 +83,6 @@ client.once(Events.ClientReady, async () => {
|
||||
client.on(Events.InteractionCreate, async interaction => {
|
||||
// Slash command: /register
|
||||
if (interaction.isChatInputCommand() && interaction.commandName === 'register') {
|
||||
if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) {
|
||||
return interaction.reply({ content: 'You must be an administrator.', ephemeral: true });
|
||||
}
|
||||
|
||||
// Check if loggingChannel is set
|
||||
if (!data.loggingChannel) {
|
||||
return interaction.reply({
|
||||
@ -117,10 +113,6 @@ client.on(Events.InteractionCreate, async interaction => {
|
||||
|
||||
// Slash command: /key
|
||||
if (interaction.isChatInputCommand() && interaction.commandName === 'keys') {
|
||||
if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) {
|
||||
return interaction.reply({ content: 'You must be an administrator.', ephemeral: true });
|
||||
}
|
||||
|
||||
const sub = interaction.options.getSubcommand();
|
||||
|
||||
// /key load
|
||||
@ -178,9 +170,6 @@ client.on(Events.InteractionCreate, async interaction => {
|
||||
|
||||
// /keys logging
|
||||
if (sub === 'logging') {
|
||||
if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) {
|
||||
return interaction.reply({ content: 'You must be an administrator.', ephemeral: true });
|
||||
}
|
||||
const channel = interaction.options.getChannel('channel');
|
||||
if (!channel) {
|
||||
return interaction.reply({ content: 'Invalid channel.', ephemeral: true });
|
||||
@ -195,9 +184,6 @@ client.on(Events.InteractionCreate, async interaction => {
|
||||
|
||||
// Handle key load confirmation buttons
|
||||
if (interaction.isButton() && (interaction.customId === 'key_load_yes' || interaction.customId === 'key_load_no')) {
|
||||
if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) {
|
||||
return interaction.reply({ content: 'You must be an administrator.', ephemeral: true });
|
||||
}
|
||||
if (!client.tempKeyLoads || !client.tempKeyLoads[interaction.user.id]) {
|
||||
return interaction.reply({ content: 'No pending key load found.', ephemeral: true });
|
||||
}
|
||||
@ -283,40 +269,6 @@ client.on(Events.InteractionCreate, async interaction => {
|
||||
return interaction.reply({ content: 'Unable to send DM. Please change your privacy settings or reach out to <@404872989188816906> in <#580122303342313473> for support!', ephemeral: true });
|
||||
}
|
||||
}
|
||||
|
||||
// Slash command: /setlogging
|
||||
if (interaction.isChatInputCommand() && interaction.commandName === 'setlogging') {
|
||||
if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) {
|
||||
return interaction.reply({ content: 'You must be an administrator.', ephemeral: true });
|
||||
}
|
||||
const channel = interaction.options.getChannel('channel');
|
||||
if (!channel) {
|
||||
return interaction.reply({ content: 'Invalid channel.', ephemeral: true });
|
||||
}
|
||||
data = loadData();
|
||||
data.loggingChannel = channel.id;
|
||||
saveData(data);
|
||||
await channel.send(`Successfully set logging channel for all Swordcery Key Bot-related messages to <#${channel.id}>.`);
|
||||
return interaction.reply({ content: `Logging channel set to <#${channel.id}>.`, ephemeral: true });
|
||||
}
|
||||
|
||||
// Slash command: /getkey
|
||||
if (interaction.isChatInputCommand() && interaction.commandName === 'getkey') {
|
||||
if (!interaction.member.permissions.has(PermissionsBitField.Flags.Administrator)) {
|
||||
return interaction.reply({ content: 'You must be an administrator.', ephemeral: true });
|
||||
}
|
||||
const user = interaction.options.getUser('user');
|
||||
if (!user) {
|
||||
return interaction.reply({ content: 'Invalid user.', ephemeral: true });
|
||||
}
|
||||
data = loadData();
|
||||
const found = data.users.find(u => u.id === user.id);
|
||||
if (found && found.key) {
|
||||
return interaction.reply({ content: `User <@${user.id}> has registered key: \`${found.key}\``, ephemeral: true });
|
||||
} else {
|
||||
return interaction.reply({ content: `User <@${user.id}> does not have a registered key.`, ephemeral: true });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
client.login(TOKEN);
|
||||
|
||||
Reference in New Issue
Block a user