trying making a bot that send custom message
Hey im trying to make my first bot where it can send custom message but doesnt works no /text to see when i write it please help
22 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!this is my index.js const { Client, GatewayIntentBits, EmbedBuilder } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] });
const TOKEN = 'meh';
client.once('ready', () => {
console.log(
await interaction.reply('This is a test response!'); } }); client.login(TOKEN);
Logged in as ${client.user.tag}
);
});
client.on('interactionCreate', async (interaction) => {
if (!interaction.isCommand()) return;
const { commandName } = interaction;
if (commandName === 'text') {
const customText = 'Your Custom Text Here';
const borderColor = '#FF0000';
const imageUrl = 'https://example.com/your-image.png';
const embed = new EmbedBuilder()
.setColor(borderColor)
.setDescription(customText)
.setImage(imageUrl)
.setTimestamp();
await interaction.reply({ embeds: [embed] });
} else if (commandName === 'test') {await interaction.reply('This is a test response!'); } }); client.login(TOKEN);
where do you deploy your commands
is this ai code
my deploy commands const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const TOKEN = '';
const CLIENT_ID = '1301979763543506976'; const commands = [ { name: 'text', description: 'Sends a custom message with a colored border and image.', }, { name: 'test', description: 'A simple test command.',
}, ]; const rest = new REST({ version: '9' }).setToken(TOKEN); (async () => { try { console.log('Started refreshing application (/) commands.'); await rest.put(Routes.applicationCommands(CLIENT_ID), { body: commands, }); console.log('Successfully reloaded application (/) commands.'); } catch (error) { console.error(error); } })(); looked for tutorials on ytb and needed a little help :FeelsDonkMan:
const CLIENT_ID = '1301979763543506976'; const commands = [ { name: 'text', description: 'Sends a custom message with a colored border and image.', }, { name: 'test', description: 'A simple test command.',
}, ]; const rest = new REST({ version: '9' }).setToken(TOKEN); (async () => { try { console.log('Started refreshing application (/) commands.'); await rest.put(Routes.applicationCommands(CLIENT_ID), { body: commands, }); console.log('Successfully reloaded application (/) commands.'); } catch (error) { console.error(error); } })(); looked for tutorials on ytb and needed a little help :FeelsDonkMan:
well, follow the guide
not youtube tutorials
and did you run your deploy script
node ?
look everything fine
and did you run your bot
yeah and works to
but no /text dont work it even doesnt appears
so it doesnt work then
did you restart your discord client
eumh u mean my discord app ?
yes
no
do i need ?
yes
yow shi thx
hero
@treble/luna why i need always to restart and cant just write after i write node
what?
you see under there is Logged in as blabla but when i try to write further i cant write and C:\ doesnt come back
press ctrl c
hero