to send a message in a specific channel
hello I would like to send a message in a specific channel here is my code
56 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!
error :
Cannot send empty message
i try it thx
there are no more errors but the message is not sent
Oh the channel type check is different in v14 btw
ok
ChannelType is imported from djs
It's weird that this didn't sent any errors ![Thonk](https://cdn.discordapp.com/emojis/264701195573133315.png)
![Thonk](https://cdn.discordapp.com/emojis/264701195573133315.png)
not work
you are french ?
Non
ok
no error
Nothing is sent by the bot?
Did you save the file and restarted the bot?
yes
Did you check is the channel invalid or is the id correct? ![Thinkeng](https://cdn.discordapp.com/emojis/264703959015489537.png)
![Thinkeng](https://cdn.discordapp.com/emojis/264703959015489537.png)
🤣
im stupid
wait
Waiting ![dogeHaHa](https://cdn.discordapp.com/emojis/895685973097205822.png)
![dogeHaHa](https://cdn.discordapp.com/emojis/895685973097205822.png)
Oh what did you define as the client?
?
The bot client
?
yes
change the
client
with interaction.client
Or what you named your interaction
In the code snippet i sentnoo
as been saved
Yeah because client isn't defined
You need the client, which is available via <interaction>.client and interaction being what you defined your interaction in the handler
i no handler
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1183325195944071238/image.png)
😅
you have commands folder..
show ur index.js
The error spawns at ping.js ![Thonk](https://cdn.discordapp.com/emojis/264701195573133315.png)
![Thonk](https://cdn.discordapp.com/emojis/264701195573133315.png)
all index.js ??
just the commands handler part
I do not have any 😅
then how do you access all commands in the
commands
folder?hmm
how ur interactionCreate event looks like
euh ?
mb, i just read the issue, use this in your ping command
I don't think I have one either
Just show ping.js
euh
Erreur lors de l'envoi du message : TypeError: message.client.channels.get is not a function
![Thonk](https://cdn.discordapp.com/emojis/264701195573133315.png)
message.client.channels.cache.get()
Oh woops
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined
- All SCREAMING_SNAKE_CASE
enums have been changed to PascalCase
- Intents: Intents.FLAGS.GUILD_MESSAGES
-> GatewayIntentBits.GuildMessages
- Permissions: Permissions.FLAGS.SEND_MESSAGES
-> PermissionFlagsBits.SendMessages
remove
"GUILD_TEXT"
and use ChannelType.GuildText
🤣
wait
Waiting again ![dogeHaHa](https://cdn.discordapp.com/emojis/895685973097205822.png)
![dogeHaHa](https://cdn.discordapp.com/emojis/895685973097205822.png)
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1183328490364342293/image.png)
Yes it is
ok
Hu
Erreur lors de l'envoi du message : ReferenceError: ChannelType is not defined
alors
hmm
import it
const { ChannelType, EmbedBuilder } = require("discord.js");
yes is work
i love you Kin and Disaster
De rien
🙂
I saw isText() being deprecated and the guide suggesting to use enums. I didn't know it just had a rename
keep in mind
Aah i didn't update to that yet
I didn't notice ![meguFace](https://cdn.discordapp.com/emojis/485155746489565194.png)
![Thonk](https://cdn.discordapp.com/emojis/264701195573133315.png)
![meguFace](https://cdn.discordapp.com/emojis/485155746489565194.png)