small pagination util function

master
Kit Kasune 3 years ago
parent 880d07e300
commit 9aaa88c60e
  1. 1
      util/pagination.d.ts
  2. 3
      util/pagination.js
  3. 2
      util/ts/pagination.ts

@ -24,6 +24,7 @@ export declare class Pagination {
user?: 'any' | string;
}): Promise<Pagination>;
stop(): Promise<Pagination>;
getCurrentPage(): MessageEmbed;
}
interface ExtraControls {
}

@ -116,7 +116,7 @@ class Pagination {
this.controllers.collector.stop();
let fe = this.message.embeds[0];
fe.setDescription(`${fe.description}\n\n*This menu has ended, start a new one to interact with it!*`);
fe.setFooter(`${fe.footer.text} | Menu ended`, this.client.user.avatarURL());
fe.setFooter(`${fe.footer && fe.footer.text && fe.footer.text.length ? ` | ${fe.footer.text}` : ''}Menu ended`, this.client.user.avatarURL());
await this.message.edit({ embeds: [fe] });
clearInterval(this.timeoutInterval);
return this;
@ -132,5 +132,6 @@ class Pagination {
return await this.endControllers();
}
;
getCurrentPage() { return this.pages[this.currentPage]; }
}
exports.Pagination = Pagination;

@ -146,6 +146,8 @@ export class Pagination {
return await this.endControllers();
};
public getCurrentPage(): MessageEmbed {return this.pages[this.currentPage];}
}

Loading…
Cancel
Save