简体   繁体   中英

Mention a user with a Discord bot (JavaScript)

I'm attempting to make a bot on discord.js, but I can't figure out how to mention users. For example:

@user#1234 high fived @user#5678

A command like that. I've tried looking it up but I can't find anything helpful. Anyone on here know how to make that? I'm a beginner so I don't really know what I'm doing

Use <@ID> where ID is the member's ID. Since you're using Discord.js, converting a GuildMember to a string does that automatically.

Example from the docs :

// Logs: Hello from <@123456789012345678>!
console.log(`Hello from ${member}!`);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM