I am making a welcome message but I can’t seem to make it say the rule channel. I want the bot to say #rules and make it so you can click it to go to the rules channel. I know you can do this with a normal user, but I want to do it with my bot. Every time I try, it can’t be clicked like a normal player. I’ve tried doing #rules, <#channelID>, and other stuff. None of them are clickable.
Asked
Active
Viewed 5.2k times
10
-
I know it is possible, as I have seen other bots do it. – Pruina Tempestatis Mar 18 '18 at 23:49
-
Paste String with your welcome message – Artur P. Mar 18 '18 at 23:56
1 Answers
25
You need to send a GuildChannel
for the channel name to be clickable.
You can achieve this by finding the channel in guild.channels.cache
This returns a Collection, which you can filter.
If you have an ID (easier):
var message = "Make sure to check the rules at " +
message.guild.channels.cache.get('channelID').toString();
If you want find the channel by ID (might break if you have multiple channels with the same name):
var message = "Make sure to check the rules at " +
message.guild.channels.find(channel => channel.name === "rules").toString();
EDIT:
Much easier way: in Discord mention the channel and put a \
(backslash) before the channel name \#rules
. You'll get something like <#channelID>
.
Use that like this: var message = "Make sure to check the rules at <#channelID>";
-
Strange, the edited works for me. What method are you using to send the message? – André Mar 19 '18 at 08:51
-
-
`message.guild.channels.find` is wrong, should be `message.guild.channels.cache.find`. – James Wilkins Apr 15 '21 at 02:22
-