Discord TypeError:如果没有';新';
每当我尝试运行=help命令时,就会出现错误“TypeError:Class构造函数DiscordPagination不能在没有“new”的情况下调用”。我想用 下面是我的代码:Discord TypeError:如果没有';新';,discord,discord.js,Discord,Discord.js,每当我尝试运行=help命令时,就会出现错误“TypeError:Class构造函数DiscordPagination不能在没有“new”的情况下调用”。我想用 下面是我的代码: const Discord = require ('discord.js') module.exports = { name: 'hhelp', description:' new help command', async execute (message, args) { const fun
const Discord = require ('discord.js')
module.exports = {
name: 'hhelp',
description:' new help command',
async execute (message, args) {
const fun = new Discord.MessageEmbed ()
.setTitle ('Fun!')
.addField (`8-ball`,' Tells the answer to your question')
.addField (`Meme`,' Displays some of the finest memes on Reddit')
.addField (`Dank-meme`,' Displays some of the dankiest memes on Reddit')
.addField (`Boop`, 'Boops a user the same kind the command is , USELESS!')
.addField (`Mod`,' Ever heard of a discord mod ? :D')
.setTimestamp ()
const DankMemer = new Discord.MessageEmbed ()
.setTitle ('Dank-Memer!')
.addField (`heist`,'Unlocks a channel for a **specific** role mentioned')
.addField (`Over`, 'Locks the channel for the role mentioned')
.setTimestamp ()
const Utility = new Discord.MessageEmbed ()
.setTitle ("Utility")
.addField (`Covid`, 'Tells the covid cases for a specific country or the entire world combined')
.addField (`Ping`, 'Tells the latency of the bot')
.addField (`Invite`, 'Gives the invite link for the bot')
.addField (`Vote`, 'Gives the top.gg voting link for the bot')
.addField (`Avatar`, 'Gives the avatar of a user')
.setTimestamp ()
const pages = [
fun,
DankMemer,
Utility
]
const emojiList = ["⬅", "➡"]
const timeout = '120000'
pagination (message, pages, emojiList, timeout)
}
} ```
错误是不言自明的。像任何类一样,您必须使用关键字
new
@Elitezen对其进行初始化,我该怎么做?对不起,我有点新,如果可能,请编辑代码。谢谢,在尝试使用JavaScript库之前了解JavaScript是很自然的。请参阅MDN@Elitezen的课程指南,谢谢,我已经阅读并解决了这个问题