我有这个问题,我无法发送消息到特定的通道,我可以使用此代码发送消息:
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
我正在尝试用不和谐的机器人来创建一个语音频道。这是我的代码(我使用的是discord.js)
message.channel.createChannel('General', "voice").then(chan => {
chan.userLimit("5");
})
但是控制台日志是这样的
(node:13080) UnhandledPromiseRejectionWarning: TypeError: message.channel.createChannel is not a function
我怎么处理这件事?
我的代码是:(编辑)
const channels = [];
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('mainframe')
.setDescription('bot will post to the mainframe for you.')
.addStringOption(option =&g
我试图做到这一点,所以如果命令是在DM通道而不是服务器通道中使用,那么我的不和谐机器人就会向用户发送一条消息。但是这段代码不起作用,使用时会抛出一个错误。有小费吗?
if (command === 'join'){
if(message.channel.type === 'dm'){
message.author.send("You need to be in a voice channel in a server to use this command. ");
我有一个服务器信息命令,它在v12中有效,但我更新到了v13。在v12中,当我发送命令时,它会响应正确的区域,但在v13中,当我发送命令时,它会在服务器区域响应undefined,help! 这是服务器信息命令: const Discord = require('discord.js');
module.exports = {
name: "serverinfo",
aliases: ["si"],
description: "Shows all Info about the Server!",
我试图将一个嵌入发送到另一个通道,而不是执行命令的通道,但我得到了一个错误:“在初始化之前不能访问'bot‘”,我不知道我做错了什么,tbh在index.js顶部声明了所有的内容。
case "alert":
let text = message.content.replace(prefix + "alert", "")
const alertembed = new Discord.MessageEmbed()
.setTitle("**Embed Title**")
我正在使用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
我有一个discord.js自机器人,我试图让它创建一个服务器,任何帮助都是很棒的。
我试过和client.user混在一起,但什么都没找到
另外,如果您不能使用discord.js创建服务器(因为它不是用于自机器人的),我愿意使用外部库(请求、axios等)。
我用的是 (discord.js v12)
client.on('message', message => {
if (message.content === '!createserver') {
// make server here
message.reply('C