所以我想问一下我必须写些什么,以便我的机器人对他发送的他自己的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);
答案 0 :(得分: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("?")
})