Reputation: 99
I'd like our Discord Bot to mention a specific channel, and let it be clickable. I understand mentioning a user you use the user ID. I do have the channel Id, just unsure how to implement it.
Upvotes: 6
Views: 53416
Reputation:
Channels on Discord have this special kinda syntax here:
<#channel id>
As commented by Elitezen here, running toString()
on a Channel
can do that mention for you. Then, just send that string yourself. It's much simpler than manually doing it.
Like this if you're answering a message:
message.channel.send(message.channel.toString());
Also, like answered by others in this question, you can do that yourself if you feel like it.
If you have a Channel object already, you can do something like this (imagine your channel is named myChannel
- it doesn't have to be named that, though):
message.channel.send(`<#${message.channel.id}>`);
Upvotes: 1
Reputation: 2990
You just have to do the following:
message.channel.send('Please take a look at this Discord Server channel <#CHANNELID>')
or if you get the channel id from the bot
const channel = message.guild.channels.find(channel => channel.name === 'Name of the channel');
message.channel.send(`Please take a look at this Discord Server channel <#${channel.id}>`)
Then the channel is clickable like in this screenshot:
Upvotes: 13