fix/remove allowed channels

This commit is contained in:
SowinskiBraeden committed 2024-04-24 08:23:11 -07:00
1 parent 485b1ee219
commit efde626f1a
2 files changed
+5 -5

No files matched your search

+4 -4
View File
@@ -433,11 +433,11 @@ module.exports = {
const optRemoveChannel = new ActionRowBuilder() const optRemoveChannel = new ActionRowBuilder()
.addComponents( .addComponents(
new ButtonBuilder() new ButtonBuilder()
.setCustomId(`RemoveAllowedChannels-yes-${interaction.member.user.id}`) .setCustomId(`RemoveAllowedChannels-yes-${channelid}-${interaction.member.user.id}`)
.setLabel("Yes") .setLabel("Yes")
.setStyle(ButtonStyle.Danger), .setStyle(ButtonStyle.Danger),
new ButtonBuilder() new ButtonBuilder()
.setCustomId(`RemoveAllowedChannels-no-${interaction.member.user.id}`) .setCustomId(`RemoveAllowedChannels-no-${channelid}-${interaction.member.user.id}`)
.setLabel("No") .setLabel("No")
.setStyle(ButtonStyle.Success) .setStyle(ButtonStyle.Success)
) )
@@ -829,7 +829,7 @@ module.exports = {
RemoveAllowedChannels: { RemoveAllowedChannels: {
run: async (client, interaction, GuildDB) => { run: async (client, interaction, GuildDB) => {
if (!queryString.endsWith(interaction.member.user.id)) { if (!interaction.customId.endsWith(interaction.member.user.id)) {
return ButtonInteraction.reply({ return ButtonInteraction.reply({
content: "This button is not for you", content: "This button is not for you",
flags: (1 << 6) flags: (1 << 6)
@@ -838,7 +838,7 @@ module.exports = {
let action = '' let action = ''
if (interaction.customId.split('-')[1]=='yes') { if (interaction.customId.split('-')[1]=='yes') {
action = 'removed'; action = 'removed';
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull:{"server.allowedChannels": channelid}}, (err, res) => { client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$pull:{"server.allowedChannels": interaction.customId.split('-')[2]}}, (err, res) => {
if (err) return client.sendInternalError(interaction, err); if (err) return client.sendInternalError(interaction, err);
}); });
} else if (interaction.customId.split('-')[1]=='no') action = 'kept'; } else if (interaction.customId.split('-')[1]=='no') action = 'kept';
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "dayzr-bot", "name": "dayzr-bot",
"version": "13.0.11", "version": "13.0.12",
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.", "description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
"main": "index.js", "main": "index.js",
"nodemonConfig": { "nodemonConfig": {