我有一个问题:当我添加角色成员时,我的机器人在我的主服务器上崩溃(reuuu在dev服务器上),在dev服务器上,角色reuuu工作得很好。
我不明白这个错误。
^
TypeError: Cannot read property 'hasPermission' of null
at Client.<anonymous> (/home/container/index.js:96:23)
at Client.emit (events.js:326:22)
at MessageCreateAction.
我正在尝试编写一个不和谐的机器人,发送消息给列表中的所有用户。我在discord.js上使用client.users.fetch();方法时遇到问题。这条错误消息说明了DiscordAPIError的一些问题:未知用户、未处理的promise rejection和DiscordAPIError: Cannot send messages to this user,尽管我和机器人在同一个行会里。以下是我到目前为止拥有的代码: const Discord = require('discord.js');
const client = new Discord.Client();
c
我正在为一个客户开发一个不和谐的机器人网站,他需要实时统计他的不和谐机器人在网站上有多少台服务器。我不知道discord.js,也找不到一个简单的答案。
这些都是我已经做过的事情:
添加了来自node.js的discord.js在StackOverflow上尝试了多种解决方案(没有一个给出了正确的答案)
let element = document.getElementById('serverCount')
let serverCount;
// This is where the code to get the discord bot server count shou
当我尝试在我的discord.js机器人的控制台中运行npm时,我不知道为什么它不能工作。
(这是我的package.json)
{
"name": "spinier-bot",
"version": "1.0.0",
"description": "Moderation & utility bot with a little bit of fun sprinkled in.",
"main": "src/bot.js",
"scr
我试图制作一个discord.js机器人,每当有人在不和谐时输入某个命令,它就会在我的PC上打开一个程序:
client.on("message", (message) => {
if (message.content == "!ping") {
//here I want to open a program on my pc
}
});
我的Discrod.JS机器人在线,但没有响应。这是代码-
// require the discord.js module
const Discord = require('discord.js');
// create a new Discord client
const client = new Discord.Client();
// when the client is ready, run this code
// this event will only trigger one time after logging in
client.once('re
当我尝试运行membermanager.fetch(); (documentation)时,我得到错误Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time. 我有一个相当好的互联网连接,我试着给它更多的时间。这既发生在我的测试服务器上,也发生在有大约10个成员的测试服务器上,也发生在有大约30个成员的服务器上。membermanager.cache不能满足我的用例。这不是一个暂时的问题,因为这也发生在昨天。我的discord.js版本是12.4.1,我今天早上更新了它。如果它有帮助,机器人是用typescript编写
const Discord = require('discord.js');
const client = new Discord.Client();
var moment = require('moment');
const token = '//not telling you this';
const PREFIX = '!';
client.on('ready', () =>{
console.log('SaltBot is online');
})
var a = m