0

所以我想问我必须写什么,以便我的机器人对他发送的他自己的 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);
4

1 回答 1

1

您需要使用 .then 函数来响应机器人消息:

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-04-14T16:39:23.487 回答