4.1.8 prevent command usage in non allowed channels

This commit is contained in:
SowinskiBraeden committed 2022-12-07 17:49:59 -08:00
1 parent b5211ad6bc
commit 8d010d336b
5 files changed
+14 -9

No files matched your search

+2
View File
@@ -21,6 +21,8 @@ module.exports = {
* @param {*} param3 * @param {*} param3
*/ */
run: async (client, interaction, args, { GuildDB }) => { run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id))
return interaction.send({ content: `You are not allowed to use the bot in this channel.`, flags: (1 << 6) });
let available = new SelectMenuBuilder() let available = new SelectMenuBuilder()
.setCustomId(`View-1-${interaction.member.user.id}`) .setCustomId(`View-1-${interaction.member.user.id}`)
+3 -2
View File
@@ -27,12 +27,13 @@ module.exports = {
* @param {*} param3 * @param {*} param3
*/ */
run: async (client, interaction, args, { GuildDB }) => { run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id))
return interaction.send({ content: `You are not allowed to use the bot in this channel.`, flags: (1 << 6) });
// Handle invalid roles
let des; let des;
if (GuildDB.excludedRoles.includes(args[0].value)) des = '**Notice:**\n> This role has been configured to be excluded to claim an armband.'; if (GuildDB.excludedRoles.includes(args[0].value)) des = '**Notice:**\n> This role has been configured to be excluded to claim an armband.';
if (!interaction.member.roles.includes(args[0].value)) des = '**Notice:**\n> You cannot claim an armband for a role you don\'t have.'; if (!interaction.member.roles.includes(args[0].value)) des = '**Notice:**\n> You cannot claim an armband for a role you don\'t have.';
if (des) return interaction.send({ embeds: [new EmbedBuilder().setColor(client.config.Colors.Yellow).setDescription(des)], flags: (1 << 6) }); if (des) return interaction.send({ embeds: [new EmbedBuilder().setColor(client.config.Colors.Yellow).setDescription(des)], flags: (1 << 6) });
// If this faction has an existing record in the db // If this faction has an existing record in the db
+2
View File
@@ -20,6 +20,8 @@ module.exports = {
* @param {*} param3 * @param {*} param3
*/ */
run: async (client, interaction, args, { GuildDB }) => { run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id))
return interaction.send({ content: `You are not allowed to use the bot in this channel.`, flags: (1 << 6) });
let factions = new EmbedBuilder() let factions = new EmbedBuilder()
.setColor(client.config.Colors.Default) .setColor(client.config.Colors.Default)
+6 -6
View File
@@ -53,13 +53,13 @@ module.exports = {
*/ */
run: async (client, interaction, args) => { run: async (client, interaction, args) => {
if (args[0].name == 'version') { if (args[0].name == 'version') {
const versionEmbed = new EmbedBuilder() const versionEmbed = new EmbedBuilder()
.setTitle(`Current DayzArmbands Version`) .setTitle(`Current DayzArmbands Version`)
.setDescription(client.config.Version); .setDescription(client.config.Version);
return interaction.send({ embeds: [versionEmbed] }); return interaction.send({ embeds: [versionEmbed] });
} else if (args[0].name == 'commands') { } else if (args[0].name == 'commands') {
let Commands = client.commands.filter((cmd) => { let Commands = client.commands.filter((cmd) => {
return !cmd.debug return !cmd.debug
}).map((cmd) => }).map((cmd) =>
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "dayz-armbands", "name": "dayz-armbands",
"version": "4.1.7", "version": "4.1.8",
"description": "A Discord Bot to handle DayZ server flags and armbands for in game factions.", "description": "A Discord Bot to handle DayZ server flags and armbands for in game factions.",
"main": "index.js", "main": "index.js",
"nodemonConfig": { "nodemonConfig": {