mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 22:15:37 +00:00
feat: Added common logic for validating command execution
This commit is contained in:
1 parent
780d6f4de3
commit
c7400f9fcd
16 files changed
+155
-244
No files matched your search
@@ -1,4 +1,5 @@
|
||||
const { embedOptions, systemOptions } = require('../../config');
|
||||
const { embedOptions } = require('../../config');
|
||||
const { notValidGuildId } = require('../../utils/validation/systemCommandValidation');
|
||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
@@ -8,16 +9,8 @@ module.exports = {
|
||||
.setDescription('Show list of guilds where bot is added.')
|
||||
.setDMPermission(false),
|
||||
execute: async ({ interaction, client }) => {
|
||||
if (!systemOptions.systemGuildIds.includes(interaction.guildId)) {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`**${embedOptions.icons.warning} Oops!**\nNo permission to execute this command.\n\nThe command \`${interaction.commandName}\` cannot be executed in this server.`
|
||||
)
|
||||
.setColor(embedOptions.colors.warning)
|
||||
]
|
||||
});
|
||||
if (await notValidGuildId(interaction)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let guildsList = client.guilds.cache
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const { embedOptions, systemOptions } = require('../../config');
|
||||
const { embedOptions } = require('../../config');
|
||||
const { notValidGuildId } = require('../../utils/validation/systemCommandValidation');
|
||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||
const { useQueue } = require('discord-player');
|
||||
const osu = require('node-os-utils');
|
||||
@@ -8,16 +9,8 @@ module.exports = {
|
||||
isSystemCommand: true,
|
||||
data: new SlashCommandBuilder().setName('status').setDescription('Show bot status.').setDMPermission(false),
|
||||
execute: async ({ interaction, client }) => {
|
||||
if (!systemOptions.systemGuildIds.includes(interaction.guildId)) {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`**${embedOptions.icons.warning} Oops!**\nNo permission to execute this command.\n\nThe command \`${interaction.commandName}\` cannot be executed in this server.`
|
||||
)
|
||||
.setColor(embedOptions.colors.warning)
|
||||
]
|
||||
});
|
||||
if (await notValidGuildId(interaction)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const interactionLatency = Date.now() - interaction.createdTimestamp;
|
||||
|
||||
Reference in new issue
Block a user