【问题标题】:discord.js pagination embedsdiscord.js 分页嵌入
【发布时间】:2021-07-23 14:59:15
【问题描述】:

所以基本上我有一系列物品:[苹果、香蕉、桃子、梨、椰子、橙子……等等]

我想在嵌入中显示它们,但由于嵌入有字符限制,我希望每页仅显示 10 个元素,并且每当用户使用箭头表情符号做出反应时 - 它会将它们带到另一页 - 所以基本上是分页嵌入。但是无论我尝试多少方法,我似乎都无法做到这一点-非常感谢帮助!

P.S - 我因为沮丧而删除了我的代码,所以我无法提供代码 - 无论如何我的代码不会有任何帮助 -

【问题讨论】:

  • 您在哪一部分特别需要帮助?每次嵌入添加 10 个项目或在用户对箭头做出反应后编辑嵌入?

标签: javascript pagination discord.js


【解决方案1】:

我建议为此使用discord.js-pagination 模块。它允许您提供一个嵌入数组,然后它可以处理所有困难的事情。

const pagination = require('discord.js-pagination');

// array of the embeds to send
// The embeds cannot have footers as the module adds the page number here.
const pages = [
    new MessageEmbed().setTitle('1'),
    new MessageEmbed().setTitle('2'),
    new MessageEmbed().setTitle('3'),
]

// basic usage
pagination (msg, pages);

【讨论】:

  • 每个人都一直在粘贴这个,但是我实际上在哪里调用 module.exports = { name: 'h', //.ping cooldown: 5, description: 'Current Release Schedule',执行(消息) { }, };
猜你喜欢
  • 2020-11-16
  • 2021-02-07
  • 2021-08-01
  • 2020-12-05
  • 2020-07-14
  • 2020-11-19
  • 1970-01-01
  • 1970-01-01
  • 2021-05-10
相关资源
最近更新 更多