简体   繁体   中英

Discord.js send message to specific channel and react to it

I know you can do something like this:

const channel = await client.channels.fetch("Channel id");
  channel.send('Message');

But what if I wanted to react to the message I sent? You need the message object to react right?

The TextChannel#send returns a Promise < Message >. You'll have to await the message to be sent to be able to react to it.

const channel = await client.channels.fetch('Channel id');
const message = await channel.send('Message');
await message.react('👍');
console.log('Reacted to message.');

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