我想在我的discord机器人上使用以下版本的discord.js:
discord.js v11.6.4 discord.js v12.4.1
我一个接一个地尝试安装它们,但都无济于事。
first
npm i discord.js@11.6.4
then
npm i discord.js@12.4.1
有没有办法在package.json中区分discordv11和v12,并在一个机器人中使用这两个模块?
我有一个关于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
我刚开始在Javascript中用编写一个不和谐的机器人,它实际上是最基本的,加载discord.js,在就绪事件上登录。
在它运行第一行代码之前,我会得到以下错误:
Debugger listening on ws://127.0.0.1:5489/3cf4a3d1-ef26-4c1c-a274-030564d40731
For help see https://nodejs.org/en/docs/inspector
i:\Coding\Bots\PURGE\node_modules\discord.js\src\util\Util.js:584
str = str.repla
我已经扫描了关于Stack溢出的所有相关主题,并尝试了所有相关的内容,但是代码无法工作:)因此,我正在学习关于如何在不和谐的情况下使用bot使成员静音的YouTube教程,下面是错误:
TypeError: person.removeRole is not a function
at Client.<anonymous> (C:\Users\hp\Documents\discordBot\Codes\index.js:39:14)
at Client.emit (events.js:311:20)
at MessageCreateAction.handle (C:\
我正在使用JavaScript和discord.js制作一个不和谐的机器人。在这里,我想向一个通道发送一个RichEmbed/MessageEmbed (我不知道它是怎么叫的)。它没有发送嵌入,而是在discord.js内部抛出了一个错误。
TypeError: fields.flat is not a function
at Function.normalizeFields (D:\discord-bot\node_modules\discord.js\src\structures\MessageEmbed.js:436:8)
at MessageEmbed.addField
我正在尝试将我的机器人的dm登录到其他服务器。我怎么能这么做呢?我正在使用V12 discord.js。 这是我的代码。 let channelID = "722595878636XX3XX5";
let guildID = "722595878636XX3XX1";
if(message.channel.type === `dm`){
let embed = new Discord.RichEmbed()
.setAuthor(client.guilds.cache.get(guildID).members.cache.get(mes
我正在尝试用不和谐的机器人来创建一个语音频道。这是我的代码(我使用的是discord.js)
message.channel.createChannel('General', "voice").then(chan => {
chan.userLimit("5");
})
但是控制台日志是这样的
(node:13080) UnhandledPromiseRejectionWarning: TypeError: message.channel.createChannel is not a function
我怎么处理这件事?
我在试着使用不和谐按钮。我正在写一些代码并运行它。但是,按钮样式代码中的错误并不是工作。我使用的是discord.js 12-,我不知道如何解决这个问题。我该怎么做? 这是错误的 the bot is online!
C:\Users\user\Downloads\bot\node_modules\discord-buttons\src\v12\Util.js:13
throw new TypeError('INVALID_BUTTON_STYLE: An invalid button styles was provided');
^
T
我有这个问题,我无法发送消息到特定的通道,我可以使用此代码发送消息:
let Channel = message.guild.channels.cache.get("749002989255131227");
Channel.send("Hello!")
但当我尝试发送它时,出现了错误:
(node:13580) UnhandledPromiseRejectionWarning: TypeError: Channel.send is not a function
at Client.<anonymous> (C:\Users\alier\De
当我试图向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
我有一个discord.js自机器人,我试图让它创建一个服务器,任何帮助都是很棒的。
我试过和client.user混在一起,但什么都没找到
另外,如果您不能使用discord.js创建服务器(因为它不是用于自机器人的),我愿意使用外部库(请求、axios等)。
我用的是 (discord.js v12)
client.on('message', message => {
if (message.content === '!createserver') {
// make server here
message.reply('C
代码 module.exports.run = async (bot, message, args) =>{
// at the top of your file
const discord = require('discord.js');
const config = require("../config");
// inside a command, event listener, etc.
const embed = new discord.MessageEmbed()
.setColor('RANDOM')
.