[英]How do I make discord bot have an emoji reaction after it sends its message in discord.js?
I want an emoji reaction AFTER the bot sends a message.在机器人发送消息后,我想要一个表情符号反应。 The code below only does it after I type in the command.
下面的代码仅在我输入命令后才会执行。 For example, these are some sample outputs:
例如,这些是一些示例输出:
Incorrect output:不正确的 output:
User types in: rules There is an emoji reaction Bot message displays用户输入:规则有一个表情符号反应机器人消息显示
Correct output: User types in: rules Bot message displays There is an emoji reaction正确的 output:用户输入:规则 Bot 消息显示 有表情符号反应
client.on('message', (rules) => {
const listen = rules.content;
if(listen === 'rules') {
rules.channel.send('```**1. Be respectful**\r\n' +
'You must respect all users, regardless of your liking towards them.\r\n\r\n' +
'**2. No Inappropriate Language**\r\n' +
'The use of profanity should be kept to a minimum.\r\n\r\n' +
'**3. No spamming**\r\n' +
'Don\'t send a lot of small messages right after each other. Do not disrupt chat by spamming.\r\n\r\n' +
'**4. No pornographic/adult/other NSFW material**\r\n' +
'This is a community server and not meant to share this kind of material.\r\n\r\n' +
'**5. No advertisements**\r\n' +
'We do not tolerate any kind of advertisements, whether it be for other communities or streams.\r\n\r\n' +
'**6. No offensive names and profile pictures**\r\n' +
'You will be asked to change your name or picture if the staff deems them inappropriate.\r\n\r\n' +
'**7. Server Raiding**\r\n Raiding or mentions of raiding are not allowed.\r\n\r\n' +
'**8. Direct & Indirect Threats**\r\n' +
'Threats to other users of DDoS, Death, DoX, abuse,' +
'and other malicious threats are absolutely prohibited and disallowed.\r\n\r\n' +
'**9. Follow the Discord Community Guidelines**\r\n' +
'You can find them here: https://discordapp.com/guidelines \r\n\r\n' +
'**10. Admins and higher roles have greater responsibility**\r\n' +
'The Admins and Mods will Mute/Kick/Ban per discretion.\r\n' +
'If you feel mistreated dm an Admin and we will resolve the issue.```\r\n' +
'**Your presence in this server implies accepting these rules, including all further changes.\r\n' +
'These changes might be done at any time without notice, it is your responsibility to check for them.**').then(rules.react(emojiArray[1]));
}
})
client.on('message', (rules) => {
const listen = rules.content;
if(listen === 'rules') {
rules.channel.send('```**1. Be respectful**\r\n' +
'You must respect all users, regardless of your liking towards them.\r\n\r\n' +
'**2. No Inappropriate Language**\r\n' +
'The use of profanity should be kept to a minimum.\r\n\r\n' +
'**3. No spamming**\r\n' +
'Don\'t send a lot of small messages right after each other. Do not disrupt chat by spamming.\r\n\r\n' +
'**4. No pornographic/adult/other NSFW material**\r\n' +
'This is a community server and not meant to share this kind of material.\r\n\r\n' +
'**5. No advertisements**\r\n' +
'We do not tolerate any kind of advertisements, whether it be for other communities or streams.\r\n\r\n' +
'**6. No offensive names and profile pictures**\r\n' +
'You will be asked to change your name or picture if the staff deems them inappropriate.\r\n\r\n' +
'**7. Server Raiding**\r\n Raiding or mentions of raiding are not allowed.\r\n\r\n' +
'**8. Direct & Indirect Threats**\r\n' +
'Threats to other users of DDoS, Death, DoX, abuse,' +
'and other malicious threats are absolutely prohibited and disallowed.\r\n\r\n' +
'**9. Follow the Discord Community Guidelines**\r\n' +
'You can find them here: https://discordapp.com/guidelines \r\n\r\n' +
'**10. Admins and higher roles have greater responsibility**\r\n' +
'The Admins and Mods will Mute/Kick/Ban per discretion.\r\n' +
'If you feel mistreated dm an Admin and we will resolve the issue.```\r\n' +
'**Your presence in this server implies accepting these rules, including all further changes.\r\n' +
'These changes might be done at any time without notice, it is your responsibility to check for them.**').then(r => r.react(emojiArray[1]));
}
})
I am not sure if I understood your problem, but try this code above.我不确定我是否理解您的问题,但请尝试上面的代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.