简体   繁体   English

Discord.js 机器人命令

[英]Discord.js bot command

After I specify a person and use the command, I want the bot to say something to that person.在我指定一个人并使用命令后,我希望机器人对那个人说些什么。 I'm new to these jobs.我是这些工作的新手。 I need your help.我需要你的帮助。

example:例子:

${prefix}warn @user123
Bot : @user123 you were warned

You can do this like this:你可以这样做:

First, you have to set a const like const user = message.mentions.users.first() It will set user to the user you mention首先,您必须设置一个常量,例如const user = message.mentions.users.first()它会将 user 设置为您提到的用户

After your command, you can put message.channel.send(`${user} you were warned`)在你的命令之后,你可以把message.channel.send(`${user} you were warned`)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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