小编fra*_*le 的帖子

Discord.js每隔1分钟发送一条消息

您好,我正在尝试发送自动消息以引起不和,但我不断收到以下错误:

bot.sendMessage is not a function
Run Code Online (Sandbox Code Playgroud)

我不确定为什么会出现此错误,下面是我的代码;

var Discord = require('discord.js');
var bot = new Discord.Client()

bot.on('ready', function() {
    console.log(bot.user.username);
});

bot.on('message', function() {
    if (message.content === "$loop") { 
      var interval = setInterval (function () {
        bot.sendMessage(message.channel, "123")
      }, 1 * 1000); 
    }
});
Run Code Online (Sandbox Code Playgroud)

javascript node.js discord

4
推荐指数
1
解决办法
3万
查看次数

标签 统计

discord ×1

javascript ×1

node.js ×1