【发布时间】:2019-04-03 23:40:26
【问题描述】:
我希望机器人检测来自服务器的消息并将其发送到我的个人服务器中的特定频道。我如何制作该代码以及如何将其合并到我的代码中?
我的代码
const Discord = require('discord.js');
const client = new Discord.Client();
const token = 'xdd';
client.login(token); // login the bot with your token.
client.on('message', message => {
if(message.content.toLowerCase() === 'help')
message.channel.send("hello " + message.author + "!");
else if(message.content.toLowerCase().includes('time'))
{
var date = new Date();
message.channel.send('The time is ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds());
}
});
【问题讨论】:
标签: javascript discord channel discord.js