我开始学习discord.js,但现在我面临着这个问题。我尝试了一些谷歌搜索,但我无法修复它。
const Discord = require('discord.js');
// const Discord = require('discord.js');
// Using Intents class
const client = new Discord.Client();
client.on('message', (msg) => {
// Send back a reply when the specific command h
我有一个关于Debian9不一致引导的问题,我试图运行我的代码,但是VPS抛给我这个错误。以前,我通常在另一个VPS上安装这个机器人,一切都正常工作,但现在它不工作了。我不知道我是否遗漏了任何模块或错误安装的节点和npm。
TypeError: fields.flat is not a function
at Function.normalizeFields (/home/bot/node_modules/discord.js/src/structures/MessageEmbed.js:443:8)
at MessageEmbed.addFields (/home/bot
因此,我正在开发一个discord.js,它使用discord.js,一个用于discord.js的node.js包装器。基本上,代码是这样工作的:
/*
A ping pong bot, whenever you send "ping", it replies "pong".
*/
// import the discord.js module
const Discord = require('discord.js');
// create an instance of a Discord Client, and call it bot
我正面临着discord.js的一个问题。在定义通道时:
client.on("guildMemberAdd", member => {
var role = member.guild.roles.find(role => role.name === "Member");
member.addRole(role);
var channel = member.guild.channels.find("name", "welcome")
channel.send("Welcome to the se
我在编写我的不和谐机器人代码时遇到了问题。每当我运行这段代码时: const Constants = require('discord.js/src/util/Constants.js')
Constants.DefaultOptions.ws.properties.$browser = `Discord iOS` 我一直收到这个错误。 Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './src/util/Constants.js' is not defined by \"export
当我试图向TextChannel发送嵌入时:
const embed = new Discord.MessageEmbed()
.setTitle('Some title')
msg.channel.send(embed);
它只是给了我一个错误:
(node:76224) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function
at Function.normalizeFields (C:\Users\user\Desktop\code\jbot\node_modu
我正在编码一个不和谐的机器人,发现了一个我无法解决的问题。
检查bot是否联机,以便在控制台中发送消息并显示丰富的内容
client.on("ready", () => {
console.log(`${client.user.username} is in the house!`);
client.user.setPresence({
status: 'online',
game: {
name: 'Cool kid the movie 2',
type: 'WATCHING
我使用节点.运行我的代码,并得到了这个错误。有什么我能解决的问题吗?
throw new RangeError('BITFIELD_INVALID', bit);
^
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: undefined.
at Function.resolve (C:\Users\huawei\Downloads\DiscordBot\node_modules\discord.js\src\util\BitField.js:152:11)
at C:
我试图让一个discord.js机器人从一个通道删除一条经过审查的消息,并将其记录在管理通道中,这是我的代码:
msg.channel.send(exampleEmbed1);
msg.guilds.find("721079782833520651").send("Test")
It says this error:
TypeError: Cannot read property 'find' of undefined
at Client.<anonymous> (/Users/DShirriff/rebelbot/rebe
node:v16.11.0 "discord.js": "^13.2.0" 我正在设置一个示例Discord.js机器人。 在this guide中,我要添加这一行: client.commands = new Collection(); Typescript然后抱怨:Property 'commands' does not exist on type 'Client<boolean>' This answer似乎和我想要的是一样的。然而,我仍然遇到了一些问题。如果我添加一个declare module "d
有人知道怎么解决这个问题吗?
client.channels.get(config.logChannel).send(embed)
^
TypeError: Cannot read property 'send' of undefined
at Client.client.once (/home/fynn/DiscordTickets/server.js:119:43)
at Object.onceWrapper (events.js:313:30)
at em
我有一个问题:当我添加角色成员时,我的机器人在我的主服务器上崩溃(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.
我有一个不和谐的机器人(实际上是两个,一个在python中),我使用我的raspberry pi 4 4gb的ram模型运行。我这样做是为了在启动时(通过crontab)自动执行js和python脚本,并将输出放在文件中。
当我试图通过机器人发送嵌入时,我得到以下信息:
(node:612) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function
at Function.normalizeFields (/HOMENAS/KitBot/node_modules/discord.js/src/s
好吧,我看到有人在谈论克隆一个git版本,但我不理解它,我遵循了他们给出的教程。 How to git clone a specific release? 这是他们给出的教程命令。 $ git clone git@github.com:mygitname/theproject.git --branch 1.0.2 下面是我尝试过的一些命令。 ~ $ git clone git@github.com:discordjs/discord.js --branch 13.2.0
Cloning into 'discord.js'...
error: cannot run ssh:
好了,我一直在开发一个机器人,它可以使用discord.js创建通道覆盖。我对discord.js比较陌生,但是我看了这个纪录片,似乎在更改覆盖时使用的正确方法是我在下面的代码中使用的方法,但我得到了一个错误消息,并且我完全不知道如何修复它。 if (command == 'lockdown') {
if (commandArgs == '') {
let channel = msg.channel;
let roles = msg.guild.roles;
console.log(roles);
let testRole = 7083847
我是typescript的新手,我发现要使用npm包,首先需要安装它的类型,比如 npm install --save @types/node-schedule 然而,我也在使用discord.js,但这不起作用 import * as Discord from 'discord.js'; 然后 npm install --save @types/discord.js
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2fdiscord.js - Not fou