aw0k3n
aw0k3n
DIAdiscord.js - Imagine an app
Created by aw0k3n on 11/7/2024 in #djs-questions
AuditLogEvent.ChannelUpdate getting logs for only 1 channel and not all channels
Thanks for replying though.
6 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 11/7/2024 in #djs-questions
AuditLogEvent.ChannelUpdate getting logs for only 1 channel and not all channels
Instead of using ChannelUpdate, I used ChannelOverwriteUpdate and it worked.
6 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 11/7/2024 in #djs-questions
AuditLogEvent.ChannelUpdate getting logs for only 1 channel and not all channels
Yes, it has Administrator permissions but I fixed it.
6 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 6/28/2024 in #djs-questions
The reply to this interaction has already been sent or deferred (Use interaction.update > once)
As for not using interaction.update again, I understood that from the error message I got from the console. Just was wondering/asking if there's a way to update the message similar to interaction.update.
10 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 6/28/2024 in #djs-questions
The reply to this interaction has already been sent or deferred (Use interaction.update > once)
That worked, thank you.
10 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 6/28/2024 in #djs-questions
The reply to this interaction has already been sent or deferred (Use interaction.update > once)
const button_action_row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('rankbinds_back')
.setLabel('Back')
.setStyle(ButtonStyle.Secondary),

new ButtonBuilder()
.setCustomId('rankbinds_next')
.setLabel('Next')
.setStyle(ButtonStyle.Secondary),
);

const buttons_message = await interaction.update({ embeds: [rankbinds_database_embeds[0]], components: [button_action_row, interaction.message.components[0]] });

const filter = (button) => button.customId == 'rankbinds_back' || button.customId == 'rankbinds_next';
const button_collector = buttons_message.createMessageComponentCollector({ filter, time: 100 * 1000 });

button_collector.on('collect', async (button) => {
if (button.customId == 'rankbinds_next') {
current_page += 1;

await interaction.update({ embeds: [rankbinds_database_embeds[current_page]] });

} else if (button.customId == 'rankbinds_back') {
current_page -= 1;

await interaction.update({ embeds: [rankbinds_database_embeds[current_page]] });
};
});
};
const button_action_row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('rankbinds_back')
.setLabel('Back')
.setStyle(ButtonStyle.Secondary),

new ButtonBuilder()
.setCustomId('rankbinds_next')
.setLabel('Next')
.setStyle(ButtonStyle.Secondary),
);

const buttons_message = await interaction.update({ embeds: [rankbinds_database_embeds[0]], components: [button_action_row, interaction.message.components[0]] });

const filter = (button) => button.customId == 'rankbinds_back' || button.customId == 'rankbinds_next';
const button_collector = buttons_message.createMessageComponentCollector({ filter, time: 100 * 1000 });

button_collector.on('collect', async (button) => {
if (button.customId == 'rankbinds_next') {
current_page += 1;

await interaction.update({ embeds: [rankbinds_database_embeds[current_page]] });

} else if (button.customId == 'rankbinds_back') {
current_page -= 1;

await interaction.update({ embeds: [rankbinds_database_embeds[current_page]] });
};
});
};
10 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 6/28/2024 in #djs-questions
The reply to this interaction has already been sent or deferred (Use interaction.update > once)
If I use .update, the console throws that error and nothing happens to the embed. If I use .editReply, the embed does get changed and the buttons are functional but with the error message This interaction failed at the bottom of the buttons.
10 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 6/28/2024 in #djs-questions
The reply to this interaction has already been sent or deferred (Use interaction.update > once)
No description
10 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 6/28/2024 in #djs-questions
The reply to this interaction has already been sent or deferred (Use interaction.update > once)
No description
10 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 6/25/2024 in #djs-questions
This interaction failed (StringSelectMenuBuilder)
I'll also use isStringSelectMenu.
13 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 6/25/2024 in #djs-questions
This interaction failed (StringSelectMenuBuilder)
Thank you.
13 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 6/25/2024 in #djs-questions
This interaction failed (StringSelectMenuBuilder)
Ah.
13 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 6/25/2024 in #djs-questions
This interaction failed (StringSelectMenuBuilder)
Yeah, I saw that. I was going to change it after I fix this.
13 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 6/25/2024 in #djs-questions
This interaction failed (StringSelectMenuBuilder)
No description
13 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 6/25/2024 in #djs-questions
This interaction failed (StringSelectMenuBuilder)
No description
13 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 6/25/2024 in #djs-questions
This interaction failed (StringSelectMenuBuilder)
interaction-create.js
else if (interaction.isSelectMenu()) {
const option = interaction.values[0].split('_')[0];

if (interaction.customId == 'rankbinds') {
const guild_rankbinds_database = await rankbinds_schema.findById({ _id: interaction.guild.id });

let rankbinds_database_embed = new EmbedBuilder()
.setColor('#E4D04C')

for (const database_group_id of guild_rankbinds_database.__v) {
const guild_rankbinds_database_group = await noblox.getGroup(database_group_id);

if (database_group_id == option) {
rankbinds_database_embed.setDescription(`Group Name: ${database_group_id ? guild_rankbinds_database_group.name : 'None.'}\nGroup ID: ${database_group_id ? database_group_id : 'None.'}`)

for (const rankbind of guild_rankbinds_database.rankbinds) {
if (rankbind[1].group_id == database_group_id) {
rankbinds_database_embed.addFields({ name: `Rankbind: ${rankbind[0]}`, value: `Template: ${rankbind[1].template}\nRoles: ${rankbind[1].roles.map((id) => `<@&${id}>`).join(', ')}\nPriority: ${rankbind[1].priority}\nIdentifier: ${rankbind[1].identifier ? rankbind[1].identifier : 'None.'}\nIdentifier Placement: ${rankbind[1].identifier_placement ? rankbind[1].identifier_placement : 'None.'}`, inline: true })
};
};

if (!rankbinds_database_embed.data.fields) rankbinds_database_embed.addFields({ name: 'No existing rankbinds:', value: 'There are no existing rankbinds to this guild.' });

break;
};
};

await interaction.message.edit({ embeds: [rankbinds_database_embed] });
else if (interaction.isSelectMenu()) {
const option = interaction.values[0].split('_')[0];

if (interaction.customId == 'rankbinds') {
const guild_rankbinds_database = await rankbinds_schema.findById({ _id: interaction.guild.id });

let rankbinds_database_embed = new EmbedBuilder()
.setColor('#E4D04C')

for (const database_group_id of guild_rankbinds_database.__v) {
const guild_rankbinds_database_group = await noblox.getGroup(database_group_id);

if (database_group_id == option) {
rankbinds_database_embed.setDescription(`Group Name: ${database_group_id ? guild_rankbinds_database_group.name : 'None.'}\nGroup ID: ${database_group_id ? database_group_id : 'None.'}`)

for (const rankbind of guild_rankbinds_database.rankbinds) {
if (rankbind[1].group_id == database_group_id) {
rankbinds_database_embed.addFields({ name: `Rankbind: ${rankbind[0]}`, value: `Template: ${rankbind[1].template}\nRoles: ${rankbind[1].roles.map((id) => `<@&${id}>`).join(', ')}\nPriority: ${rankbind[1].priority}\nIdentifier: ${rankbind[1].identifier ? rankbind[1].identifier : 'None.'}\nIdentifier Placement: ${rankbind[1].identifier_placement ? rankbind[1].identifier_placement : 'None.'}`, inline: true })
};
};

if (!rankbinds_database_embed.data.fields) rankbinds_database_embed.addFields({ name: 'No existing rankbinds:', value: 'There are no existing rankbinds to this guild.' });

break;
};
};

await interaction.message.edit({ embeds: [rankbinds_database_embed] });
13 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 4/28/2024 in #djs-questions
Objects not getting pushed to collection.
const removed_roles = [];
if (added_roles && added_roles.length && previous_rankbind[0] > account_group_rank) {
for (const role_id of previous_rankbind[1].roles) {
if (member.roles.cache.find((member_role) => member_role.id == role_id) && !next_rankbind[1].roles.find((next_role_id) => next_role_id == role_id)) {
const rankbind_role = await guild.roles.fetch(role_id);

if (rankbind_role) {
await member.roles.remove(rankbind_role);

removed_roles.push(rankbind_role);
};
};
}
};
const removed_roles = [];
if (added_roles && added_roles.length && previous_rankbind[0] > account_group_rank) {
for (const role_id of previous_rankbind[1].roles) {
if (member.roles.cache.find((member_role) => member_role.id == role_id) && !next_rankbind[1].roles.find((next_role_id) => next_role_id == role_id)) {
const rankbind_role = await guild.roles.fetch(role_id);

if (rankbind_role) {
await member.roles.remove(rankbind_role);

removed_roles.push(rankbind_role);
};
};
}
};
4 replies
DIAdiscord.js - Imagine an app
Created by aw0k3n on 4/28/2024 in #djs-questions
Objects not getting pushed to collection.
Never find, I fixed it. I had to use a for loop instead.
4 replies