ui updates and bot updates. new commands and command handler
This commit is contained in:
29
discord-bot/commands/view-autorole.js
Normal file
29
discord-bot/commands/view-autorole.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const { SlashCommandBuilder } = require('discord.js');
|
||||
const { readDb } = require('../../backend/db.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'view-autorole',
|
||||
description: 'View the current autorole configuration for this server.',
|
||||
enabled: true,
|
||||
builder: new SlashCommandBuilder()
|
||||
.setName('view-autorole')
|
||||
.setDescription('View the current autorole configuration for this server.'),
|
||||
async execute(interaction) {
|
||||
const db = readDb();
|
||||
const guildId = interaction.guildId;
|
||||
const settings = db[guildId] || {};
|
||||
const autorole = settings.autorole || { enabled: false, roleId: '' };
|
||||
|
||||
if (!autorole.enabled) {
|
||||
await interaction.reply({ content: 'Autorole is currently disabled for this server.', flags: 64 });
|
||||
return;
|
||||
}
|
||||
|
||||
const role = interaction.guild.roles.cache.get(autorole.roleId);
|
||||
if (role) {
|
||||
await interaction.reply({ content: `Autorole is enabled. Selected role: ${role.toString()} (${role.name}).`, flags: 64 });
|
||||
} else {
|
||||
await interaction.reply({ content: `Autorole is enabled but the selected role (ID: ${autorole.roleId}) was not found on this server.`, flags: 64 });
|
||||
}
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user