Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
329 views
in Technique[技术] by (71.8m points)

javascript - How do I make my Discord.JS bot react to it's own Direct Message?

When I'm making my bot, I want to make it so that when you type afv!support it will send a DM like this: DM example

Thanks for contacting AFV support. Please react below for which problem you have.
:one: Ban Appeal
:two: Bug Report
:three: Report Staff/User

This command will expire in two minutes.

and then react with :one:, :two:, and :three:. I've looked around but haven't found the answer.

Thanks for the help!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Elitezen's answer is correct, I just wanted to elaborate on their use of <emote>.

If you replace the first usage of <emote> with :one:, for example, it will not work correctly. You will have to enter the physical unicode emoji, or emoji ID if it's a custom emoji.

For example:

message.member.send(<theMessage>).then(msg => {
   await msg.react('1??') // instead of :one:
   await msg.react('2??') // instead of :two:
   msg.react('3??') // instead of :three:
})

Read this discord.js guide on reactions for more information


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...