mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 06:33:05 -04:00
dont create paginator for one page
This commit is contained in:
parent
8e489318e5
commit
951cb87a82
3 changed files with 16 additions and 0 deletions
|
@ -52,8 +52,11 @@ module.exports = class BasePaginator extends EventEmitter {
|
|||
// Create Components
|
||||
let msg = this.pages[this.index];
|
||||
msg.components = await this.client.components(this)
|
||||
|
||||
// Ensure there are no mentions
|
||||
if(!msg.message_reference) msg.reference = true
|
||||
if(!msg.allowedMentions) msg.allowedMentions = {parse: [], repliedUser: false}
|
||||
|
||||
return this.commandMessage = await this.editOrReply(msg);
|
||||
}
|
||||
|
||||
|
|
|
@ -158,6 +158,16 @@ module.exports = class Paginator {
|
|||
}
|
||||
if(listener) await listener.stop()
|
||||
|
||||
// No need for a paginator if we only have one page.
|
||||
if(data.pages.length == 1){
|
||||
let msg = data.pages[0];
|
||||
|
||||
if(!msg.message_reference) msg.reference = true
|
||||
if(!msg.allowedMentions) msg.allowedMentions = {parse: [], repliedUser: false}
|
||||
|
||||
return await data.context.editOrReply(msg);
|
||||
}
|
||||
|
||||
const instance = new InteractionPaginator(this, data);
|
||||
this.activeListeners.push(instance);
|
||||
|
||||
|
|
|
@ -77,6 +77,9 @@ module.exports.createEmbed = function(type, context, content){
|
|||
|
||||
// Adds formatted page numbers to the embed footer
|
||||
module.exports.formatPaginationEmbeds = function(embeds){
|
||||
// No formatting if we only have one page
|
||||
if(embeds.length == 1) return embeds;
|
||||
|
||||
let i = 0;
|
||||
let l = embeds.length;
|
||||
let formatted = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue