【发布时间】:2021-06-01 22:45:09
【问题描述】:
如何在这段代码中使用分页? 我不知道该怎么做。
const {MessageEmbed} = require("discord.js")
module.exports = {
name: "help",
description: "Pokazuje wszystkie komendy",
usage: "[Command name]",
cooldown: 5,
run(msg, args) {
const arg = args[0]
const embed = new MessageEmbed()
const { commands } = msg.client
const data = []
if (!args.length) {
data.push(embed.setTitle("**Komendy:**"))
data.push(embed.setDescription(commands.map((command) => command.name).join(`\n`)), true)
data.push(embed.setFooter(
`\nZastosowanie\`${PREFIX}help [command name]\` aby dostać info o komendzie!`))
return msg.channel.send(data, {split: true})
}
//podane argumenty
const name = args[0].toLowerCase()
const command =
commands.get(name) ||
commands.find((c) => c.aliases && c.aliases.includes(name))
if (!command) {
return msg.reply("Zła komenda!")
}
data.push(embed.setDescription(`**Nazwa:** ${command.name} \n **Użycie:** ${PREFIX}${command.name} ${command.usage} \n **Cooldown:** ${command.cooldown || 3} second(s)`))
msg.channel.send(data, { split:true })
},
}
没有分页,看起来很傻。 这些命令彼此下方,看起来不太好。 或者,这些命令可以彼此相邻。 比如左边的moderation和下面的command,右边的4fun and also commands
【问题讨论】:
标签: javascript discord.js