43 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
probablyraging
StringSelectMenuBuilder#addOptions method using emoji property
d.js docs
d.js docs2y ago
method StringSelectMenuBuilder#addOptions() Adds options to this select menu
Marcus
MarcusOP2y ago
does .setEmoji for menu selecter work? O.o
probablyraging
No, you need to the the emoji property of StringSelectMenuBuilder#addOptions() as I mentioned addOptions takes an REST object like
{
label: string,
value: string,
emoji: APIMessageComponentEmoji
}
{
label: string,
value: string,
emoji: APIMessageComponentEmoji
}
Marcus
MarcusOP2y ago
I don't understand. Im sorry.
probablyraging
What don't you understand? How are you adding option to your select menu currently? Show code
Marcus
MarcusOP2y ago
I think I got it. Can you try check my other question? https://discord.com/channels/222078108977594368/1094396589184913418 😄
probablyraging
It's already been answered, use the messageCreate event instead of the deprecated message event
Marcus
MarcusOP2y ago
Alright Can I use custom server emotes in the emote thing
Marcus
MarcusOP2y ago
Marcus
MarcusOP2y ago
like example <diamondemote:1285883286883286> Am I able to do something like that
probablyraging
Only the emoji ID is needed for the emoji value
Marcus
MarcusOP2y ago
Thx bro ❤️
probablyraging
<diamondemote:1285883286883286> that part np
Marcus
MarcusOP2y ago
I have no clue how to fix the message thing
probablyraging
The event?
Marcus
MarcusOP2y ago
ye..
probablyraging
client.on('messageCreate`, ...
client.on('messageCreate`, ...
Marcus
MarcusOP2y ago
and then it should work?
probablyraging
Yes
Marcus
MarcusOP2y ago
This is alright?
Marcus
MarcusOP2y ago
probablyraging
Looks good
Marcus
MarcusOP2y ago
client.on("messageCreate", async message => {


const spooferEmbed = new EmbedBuilder()
.setColor('#147df5')
.setTitle('Bubble Sp00fer')
.setDescription('**Prices**\n\n> 1x Week / 10€\n> 1x Month / 15€\n> Lifetime / 20€')
.setThumbnail('https://media.discordapp.net/attachments/1055568148281163818/1088178678170669106/bubble.png')
.setImage('https://media.discordapp.net/attachments/1055568148281163818/1088176997127176303/bubble_banner.png')

const channel = await client.channels.fetch('1092194462295404694');
channel.send({ embeds: [spooferEmbed] });

})
client.on("messageCreate", async message => {


const spooferEmbed = new EmbedBuilder()
.setColor('#147df5')
.setTitle('Bubble Sp00fer')
.setDescription('**Prices**\n\n> 1x Week / 10€\n> 1x Month / 15€\n> Lifetime / 20€')
.setThumbnail('https://media.discordapp.net/attachments/1055568148281163818/1088178678170669106/bubble.png')
.setImage('https://media.discordapp.net/attachments/1055568148281163818/1088176997127176303/bubble_banner.png')

const channel = await client.channels.fetch('1092194462295404694');
channel.send({ embeds: [spooferEmbed] });

})
It didn't send the message to the channel.. :/
probablyraging
What intents are you using? You need the Guilds and GuildMessages intents
Marcus
MarcusOP2y ago
Alright, I only had the Guilds
const client = new Client({ intents: ["Guilds", "Guild", "GuildMessages"] });
const client = new Client({ intents: ["Guilds", "Guild", "GuildMessages"] });
Good?
probablyraging
You only needs Guilds not Guild, and you should be using the GatewayIntentBits enum instead of a string
Marcus
MarcusOP2y ago
It didn't send it This is my full index file
const { Client, GatewayIntentBits, Collection, Events, EmbedBuilder, PermissionsBitField, Permissions, MessageManager, Embed } = require("discord.js");
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
});
const fs = require('fs');

client.commands = new Collection();

client.config = require("./config.json");

const functions = fs.readdirSync("./functions").filter(file => file.endsWith(".js"));
const eventFiles = fs.readdirSync("./events").filter(file => file.endsWith(".js"));
const commandFolders = fs.readdirSync("./commands");

(async () => {
for (file of functions) {
require(`./functions/${file}`)(client);
}
client.handleEvents(eventFiles, "./events");
client.handleCommands(commandFolders, "./commands");

})();


client.on("messageCreate", async message => {


const spooferEmbed = new EmbedBuilder()
.setColor('#147df5')
.setTitle('Bubble Sp00fer')
.setDescription('**Prices**\n\n> 1x Week / 10€\n> 1x Month / 15€\n> Lifetime / 20€')
.setThumbnail('https://media.discordapp.net/attachments/1055568148281163818/1088178678170669106/bubble.png')
.setImage('https://media.discordapp.net/attachments/1055568148281163818/1088176997127176303/bubble_banner.png')

const channel = await client.channels.fetch('1092194462295404694');
channel.send({ embeds: [spooferEmbed] });

})

client
.login(client.config.token)
.then(() => {
console.log(`Cliend logged in as ${client.user.username}`)
client.user.setActivity(`Support`)


})
const { Client, GatewayIntentBits, Collection, Events, EmbedBuilder, PermissionsBitField, Permissions, MessageManager, Embed } = require("discord.js");
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
});
const fs = require('fs');

client.commands = new Collection();

client.config = require("./config.json");

const functions = fs.readdirSync("./functions").filter(file => file.endsWith(".js"));
const eventFiles = fs.readdirSync("./events").filter(file => file.endsWith(".js"));
const commandFolders = fs.readdirSync("./commands");

(async () => {
for (file of functions) {
require(`./functions/${file}`)(client);
}
client.handleEvents(eventFiles, "./events");
client.handleCommands(commandFolders, "./commands");

})();


client.on("messageCreate", async message => {


const spooferEmbed = new EmbedBuilder()
.setColor('#147df5')
.setTitle('Bubble Sp00fer')
.setDescription('**Prices**\n\n> 1x Week / 10€\n> 1x Month / 15€\n> Lifetime / 20€')
.setThumbnail('https://media.discordapp.net/attachments/1055568148281163818/1088178678170669106/bubble.png')
.setImage('https://media.discordapp.net/attachments/1055568148281163818/1088176997127176303/bubble_banner.png')

const channel = await client.channels.fetch('1092194462295404694');
channel.send({ embeds: [spooferEmbed] });

})

client
.login(client.config.token)
.then(() => {
console.log(`Cliend logged in as ${client.user.username}`)
client.user.setActivity(`Support`)


})
probablyraging
Try doing some simple logging in the messageCreate event
Marcus
MarcusOP2y ago
Where do you want me to do that? I see It doesn't even run it I tried console.log at the top of the client.on
probablyraging
So you get no output at all?
Marcus
MarcusOP2y ago
Yeah
probablyraging
Make sure your events are being loaded correctly
Marcus
MarcusOP2y ago
Uhmm It seems to work although there is going 3 - 5 minutes before it is sending from I start the bot How can I fix the delay?
probablyraging
Well the event will only fire when a message is created in the server. If you want it to happen when the bot starts, use the ready event instead
Marcus
MarcusOP2y ago
OHHH I just found out haha omg what do I have to type in? just replace messageCreate => ready
probablyraging
Yep
Marcus
MarcusOP2y ago
can I make the bot send the message only once?
probablyraging
The ready event should only be emitted once, when the bot state is ready Or use client.once
Marcus
MarcusOP2y ago
Marcus
MarcusOP2y ago
that the emoji
const HxPaymentSelect = new ActionRowBuilder()
.addComponents(
new StringSelectMenuBuilder()
.setCustomId('HxPaymentSelect')
.setPlaceholder('Please select your payment method')
.addOptions(
{
label: 'PayPal',
description: 'You will be using PayPal as your payment method',
value: 'first_option',
emoji: {
name: '<:PayPal:1094915773920706622>'
},
},
{
label: 'Crypto',
description: 'You will be using Crypto as your payment method',
value: 'second_option',
emoji: {
name: '<:bitcoin:1094915686326866010>'
},
},
{
label: 'Paysafecard ( GERMANY )',
description: 'You will be using Paysafecard ( GERMANY ) as your payment method',
value: 'third_option',
emoji: {
name: '<:paysafecard:1094915739158327338>',
},
},
{
label: 'Paysafecard ( DENMARK )',
description: 'You will be using Paysafecard ( DENMARK ) as your payment method',
value: 'fourth_option',
emoji: {
name: '<:paysafecard:1094915739158327338>'
},
},
{
label: 'Mobilepay ( DENMARK )',
description: 'You will be using Mobilepay ( DENMARK ) as your payment method',
value: 'fifth_option',
emoji: {
name: '<:mobilepay:1094915721869410374>'
},
},
)
)


interaction.reply({ components: [HxPaymentSelect], embeds: [HxPaymentEmbed]})

}

}


})
const HxPaymentSelect = new ActionRowBuilder()
.addComponents(
new StringSelectMenuBuilder()
.setCustomId('HxPaymentSelect')
.setPlaceholder('Please select your payment method')
.addOptions(
{
label: 'PayPal',
description: 'You will be using PayPal as your payment method',
value: 'first_option',
emoji: {
name: '<:PayPal:1094915773920706622>'
},
},
{
label: 'Crypto',
description: 'You will be using Crypto as your payment method',
value: 'second_option',
emoji: {
name: '<:bitcoin:1094915686326866010>'
},
},
{
label: 'Paysafecard ( GERMANY )',
description: 'You will be using Paysafecard ( GERMANY ) as your payment method',
value: 'third_option',
emoji: {
name: '<:paysafecard:1094915739158327338>',
},
},
{
label: 'Paysafecard ( DENMARK )',
description: 'You will be using Paysafecard ( DENMARK ) as your payment method',
value: 'fourth_option',
emoji: {
name: '<:paysafecard:1094915739158327338>'
},
},
{
label: 'Mobilepay ( DENMARK )',
description: 'You will be using Mobilepay ( DENMARK ) as your payment method',
value: 'fifth_option',
emoji: {
name: '<:mobilepay:1094915721869410374>'
},
},
)
)


interaction.reply({ components: [HxPaymentSelect], embeds: [HxPaymentEmbed]})

}

}


})
I have tried both without the name just with the code
probablyraging
name should be id and the value should be the ID of the emoji, not the full identifier Also pretty sure you can just do emoji: '1234567890'
Want results from more Discord servers?
Add your server