sharma ji
sharma ji
DIAdiscord.js - Imagine an app
Created by sharma ji on 4/8/2024 in #djs-questions
createmessageComponentCollector is not working
https://srcb.in/NN6a4J8qzS This is my code all the select Manu are working except this one Previously I have faced this I just added fetchReply:true and it works but now it is not for this
6 replies
DIAdiscord.js - Imagine an app
Created by sharma ji on 4/7/2024 in #djs-questions
RoleSelectMenuBuilder interaction failed
Hey i am get interaction failed and no interaction i am getting
// Ask for moderation role
const moderationEmbed = new EmbedBuilder()
.setTitle(
"Please select the moderation role for managing the ticket."
)
.setColor(color)
.setFooter(footer);

const roleRow = new ActionRowBuilder().addComponents(
new RoleSelectMenuBuilder()
.setCustomId("Setup_ModerationRole_menu")
.setPlaceholder("Select a role")
.setMinValues(1)
.setMaxValues(25)
);

const msg2 = await interaction.reply({
embeds: [moderationEmbed],
components: [roleRow],
});
console.log("1")
const filterRoles = (interaction) =>
interaction.customId === "Setup_ModerationRole_menu" &&
interaction.user.id === message.author.id;

const roleCollector =
await msg2.createMessageComponentCollector({
componentType: ComponentType.RoleSelect,
filter: filterRoles,
time: 15 * 60 * 1000,
});

roleCollector.on("collect", async (interaction) => {
console.log("bi");
const selectedRole = interaction.roles; // Assuming single role selection
roleCollector.stop();
// Ask for moderation role
const moderationEmbed = new EmbedBuilder()
.setTitle(
"Please select the moderation role for managing the ticket."
)
.setColor(color)
.setFooter(footer);

const roleRow = new ActionRowBuilder().addComponents(
new RoleSelectMenuBuilder()
.setCustomId("Setup_ModerationRole_menu")
.setPlaceholder("Select a role")
.setMinValues(1)
.setMaxValues(25)
);

const msg2 = await interaction.reply({
embeds: [moderationEmbed],
components: [roleRow],
});
console.log("1")
const filterRoles = (interaction) =>
interaction.customId === "Setup_ModerationRole_menu" &&
interaction.user.id === message.author.id;

const roleCollector =
await msg2.createMessageComponentCollector({
componentType: ComponentType.RoleSelect,
filter: filterRoles,
time: 15 * 60 * 1000,
});

roleCollector.on("collect", async (interaction) => {
console.log("bi");
const selectedRole = interaction.roles; // Assuming single role selection
roleCollector.stop();
10 replies
DIAdiscord.js - Imagine an app
Created by sharma ji on 3/24/2024 in #djs-questions
Anyone have any clue what I am doing wrong
// Get the mentioned member from the message
const member = message.mentions.members.first();
if (!member) return message.channel.send('You need to mention a member to mute.');

// Check if the member has the required permissions
if (member.permissions.has(PermissionsBitField.Flags.Administrator)) {
return message.channel.send('You cannot mute an administrator.');
}
// Get the mentioned member from the message
const member = message.mentions.members.first();
if (!member) return message.channel.send('You need to mention a member to mute.');

// Check if the member has the required permissions
if (member.permissions.has(PermissionsBitField.Flags.Administrator)) {
return message.channel.send('You cannot mute an administrator.');
}
21 replies