Javascript Discord.js使用@person和#频道发送消息
使用我的discord机器人,我试图创建一条欢迎消息。 我得到了以下工作:Javascript Discord.js使用@person和#频道发送消息,javascript,discord,discord.js,Javascript,Discord,Discord.js,使用我的discord机器人,我试图创建一条欢迎消息。 我得到了以下工作: 当有人加入时发送消息 获取加入者的姓名 现在我的问题是,在这个消息中使用@或#。我对消息使用以下代码: const welcomeMessage = `Welcome @${member.user.username} to the server! Please look through the #:page_with_curl:rules and assign yourself a role at #:mortar_
- 当有人加入时发送消息
- 获取加入者的姓名
const welcomeMessage = `Welcome @${member.user.username} to the server! Please look through the #:page_with_curl:rules and assign yourself a role at #:mortar_board:role-assignment`;
但我也尝试过:
Welcome @${member.user.username} to the server! Please look through the #const welcomeMessage = `Welcome ${member}! Please look through the <#id-of-rules-channel-here> and assign yourself a role at <#id-of-role-assignment-channel-here>`
欢迎@${member.user.username}到服务器!请浏览#const welcomeMessage=`Welcome${member}!请查看并在中为自己分配一个角色`
如果已将不协调类(如频道和成员)存储在变量中,则可以自动嵌入这些类(如member
),或者你可以直接在文本中使用他们的ID,形式为频道使用
,用户使用
。关于成员,只需将member.user.username
更改为member
它将自动链接,无需添加@诅咒是,我明白了。谢谢!