How do I get my bot to mention groups
See original GitHub issuevar Discord = require("discord.js");
var bot = new Discord.Client();
bot.on("message", function (message)
{
var input = message.content.toUpperCase();
if(input === "HELP!")
{
bot.sendMessage(message, "@admins are on the way!");
}
if(input === "PING")
{
bot.sendMessage(message, "Pong!");
}
if(input === "WHO MADE SHADOWBOT?")
{
bot.sendMessage(message, "@Techmo3014#7140 made me.")
}
});
bot.loginWithToken("my token");
That is my code, could any of you edit it so the @admins and @techmo3014#7140 work?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How do I get a discord bot to mention a role and a user?
So, to mention a user you need to use their user ID <@USER_ID> / <@!USER_ID> and for a role it is similarly <@&ROLE_ID>...
Read more >Create conversation bots for channel or group chat - Teams
Work with mentions ... Every message to your bot from a group or channel contains an @mention with its name in the message...
Read more >How to Add a Telegram Bot to Telegram Group (2022 Tutorial)
In this tutorial, I will explain how you can add a Telegram chatbot to your Telegram group and automatically reply to messages in...
Read more >How to Add Bots to a Discord Server - Business Insider
How to set up MEE6 as a welcoming bot on Discord · 1. Click the Welcome option. · 2. Select what you want...
Read more >Bots Tutorial - GroupMe Developers
Using a bot is as easy as registering a member name and optional avatar url. Then you use the secret key you get...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In Discord in general you can mention people with
<@ID>
and mentionable roles with<@&ID>
. Discord.js has helper functions for that though, so<userObject>.mention()
and<roleObject>.mention()
works. Even better, these objects.toString()
will return that function, and node calls.toString()
on anything that’s interpreted as a string!So to answer your question you’d first have to get the objects and then you can simply insert them in your string:
(Although I’d recommend you to use ID’s instead of names, especially for the user)
Why doesn’t it work