guildOnly check

This commit is contained in:
Supositware 2023-04-14 17:46:12 +02:00
parent 408176cc9d
commit 780aef27c5
2 changed files with 10 additions and 0 deletions

View file

@ -42,6 +42,11 @@ export default {
return interaction.reply({ content: '❌ This command is reserved for the owner!', ephemeral: true }); return interaction.reply({ content: '❌ This command is reserved for the owner!', ephemeral: true });
} }
// Guild only check
if (command.guildOnly && !interaction.guild) {
return interaction.reply({ content: '❌ This command only work in a server!', ephemeral: true });
}
// Check if the bot has the needed permissions // Check if the bot has the needed permissions
if (command.default_permission) { if (command.default_permission) {
const clientMember = await interaction.guild.members.fetch(client.user.id); const clientMember = await interaction.guild.members.fetch(client.user.id);

View file

@ -307,6 +307,11 @@ export default {
return message.reply({ content: '❌ This command is reserved for the owner!', ephemeral: true }); return message.reply({ content: '❌ This command is reserved for the owner!', ephemeral: true });
} }
// Guild only check
if (command.guildOnly && !message.guild) {
return message.reply({ content: '❌ This command only work in a server!', ephemeral: true });
}
// Check if the bot has the needed permissions // Check if the bot has the needed permissions
if (command.clientPermissions) { if (command.clientPermissions) {
const clientMember = await message.guild.members.fetch(client.user.id); const clientMember = await message.guild.members.fetch(client.user.id);