【问题标题】:Discord Bot should react to his own dm that he sentDiscord Bot 应该对他发送的自己的 dm 做出反应
【发布时间】:2020-07-27 10:38:01
【问题描述】:

所以我想问我要写什么,以便我的机器人对他发送的他自己的 dm 做出反应

const Discord = require('discord.js');
const { prefix, token } = require('./config.json');
const client = new Discord.Client();

client.on('ready', () => {
    console.log('Ready!');
})

try{
    client.on('guildMemberAdd', member => {
    member.send(`Hello ${member}, welcome to the PotatoHost Server! 
I want to help you and so my question is: Do you want to buy a server or do you need more informations first? \n
A: I want to buy a server
B: I need more informations first \n
Please react to this message with A or B.`);
    message.react('????')
    })} catch(error){
    member.guild.channels.get("699374469977735208").send(`Hello ${member}, welcome to the PotatoHost Server!`);
    }

client.login(token);

【问题讨论】:

    标签: javascript reactjs bots discord dm


    【解决方案1】:

    您需要使用 .then 函数来响应 bot 消息:

    member.send('Hello ${member}, welcome to the PotatoHost Server! 
    I want to help you and so my question is: Do you want to buy a server or do you need more informations first? \n
    A: I want to buy a server
    B: I need more informations first \n
    Please react to this message with A or B.');
    .then(function (message) {
    message.react("?")
    message.react("?")
                })
    

    【讨论】:

      猜你喜欢
      • 2020-06-13
      • 2019-06-07
      • 2019-10-18
      • 2021-05-12
      • 2020-07-31
      • 2020-07-29
      • 2021-08-29
      • 2021-11-17
      • 1970-01-01
      相关资源
      最近更新 更多