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
d.js toolkit
d.js toolkit2mo ago
- 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!
Liksream
LiksreamOP2mo ago
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(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);
treble/luna
treble/luna2mo ago
where do you deploy your commands is this ai code
Liksream
LiksreamOP2mo ago
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:
treble/luna
treble/luna2mo ago
well, follow the guide
d.js docs
d.js docs2mo ago
:guide: Home: What's new read more
treble/luna
treble/luna2mo ago
not youtube tutorials and did you run your deploy script
Liksream
LiksreamOP2mo ago
node ?
Liksream
LiksreamOP2mo ago
look everything fine
No description
treble/luna
treble/luna2mo ago
and did you run your bot
Liksream
LiksreamOP2mo ago
yeah and works to but no /text dont work it even doesnt appears
treble/luna
treble/luna2mo ago
so it doesnt work then did you restart your discord client
Liksream
LiksreamOP2mo ago
eumh u mean my discord app ?
treble/luna
treble/luna2mo ago
yes
Liksream
LiksreamOP2mo ago
no do i need ?
treble/luna
treble/luna2mo ago
yes
Liksream
LiksreamOP2mo ago
yow shi thx hero
Liksream
LiksreamOP2mo ago
@treble/luna why i need always to restart and cant just write after i write node
No description
treble/luna
treble/luna2mo ago
what?
Liksream
LiksreamOP2mo ago
you see under there is Logged in as blabla but when i try to write further i cant write and C:\ doesnt come back
treble/luna
treble/luna2mo ago
press ctrl c
Liksream
LiksreamOP2mo ago
hero
Want results from more Discord servers?
Add your server