jacopo2199o
jacopo2199o
DIAdiscord.js - Imagine a boo! 👻
Created by jacopo2199o on 1/23/2024 in #djs-questions
bot invites unwanted members into private threads
hi, discord.js I programmed a function that emit a drop embed message (with button) in the channel that reached 100 messages something weird happen when a drop occour in a private thread channel. when this happen, a lot of unwanted and casual users of our gild spawn in it, make a disaster I noticed this occour when the bot send his message in it this is the code that generate a drop message
js const dropPromotionPoints = async (dropChannel) => {
const action = new ActionRowBuilder();
const button = new ButtonBuilder();
const channel = dropChannel.guild.channels.cache.find((channel) => channel.name === customChannels.public)
|| dropChannel.guild.channels.cache.get(dropChannel.guild.publicUpdatesChannelId);
const message1 = new EmbedBuilder();
const message2 = new EmbedBuilder();

action.addComponents(
button
.setCustomId("take")
.setLabel("take")
.setStyle(ButtonStyle.Success)
);
message1
.setTitle("📦⭐ new drop")
.setDescription("based on messages sent globally in this server. take it pressing the button below")
.addFields({ name: "type", value: "promotion points", inline: true })
.addFields({ name: "value", value: `${drops.promotionPoints} ⭐`, inline: true })
.setThumbnail(dropChannel.client.user.displayAvatarURL({ dynamic: true }))
.setTimestamp()
.setColor("DarkGreen");
message2
.setTitle("📦⭐ new drop")
.setDescription(`a *promotion points* drop spawned in ${dropChannel.name}`)
.addFields({ name: "type", value: "promotion points", inline: true })
.addFields({ name: "value", value: `${drops.promotionPoints} ⭐`, inline: true })
.setThumbnail(dropChannel.client.user.displayAvatarURL({ dynamic: true }))
.setTimestamp()
.setColor("DarkGreen");

await dropChannel.send({ embeds: [message1], components: [action] });
await channel.send({ embeds: [message2] });
};
js const dropPromotionPoints = async (dropChannel) => {
const action = new ActionRowBuilder();
const button = new ButtonBuilder();
const channel = dropChannel.guild.channels.cache.find((channel) => channel.name === customChannels.public)
|| dropChannel.guild.channels.cache.get(dropChannel.guild.publicUpdatesChannelId);
const message1 = new EmbedBuilder();
const message2 = new EmbedBuilder();

action.addComponents(
button
.setCustomId("take")
.setLabel("take")
.setStyle(ButtonStyle.Success)
);
message1
.setTitle("📦⭐ new drop")
.setDescription("based on messages sent globally in this server. take it pressing the button below")
.addFields({ name: "type", value: "promotion points", inline: true })
.addFields({ name: "value", value: `${drops.promotionPoints} ⭐`, inline: true })
.setThumbnail(dropChannel.client.user.displayAvatarURL({ dynamic: true }))
.setTimestamp()
.setColor("DarkGreen");
message2
.setTitle("📦⭐ new drop")
.setDescription(`a *promotion points* drop spawned in ${dropChannel.name}`)
.addFields({ name: "type", value: "promotion points", inline: true })
.addFields({ name: "value", value: `${drops.promotionPoints} ⭐`, inline: true })
.setThumbnail(dropChannel.client.user.displayAvatarURL({ dynamic: true }))
.setTimestamp()
.setColor("DarkGreen");

await dropChannel.send({ embeds: [message1], components: [action] });
await channel.send({ embeds: [message2] });
};
7 replies