mirror of
https://github.com/TheShadowEevee/Konpeki-Discord-Bot.git
synced 2025-01-11 14:38:49 -06:00
Allow choosing help page
This commit is contained in:
parent
01bc1a37f9
commit
a336e21a90
1 changed files with 14 additions and 3 deletions
|
@ -19,16 +19,27 @@ if (fs.existsSync('./data/help-text.json')) {
|
|||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('help')
|
||||
.setDescription('Provides information on avalible commands'),
|
||||
.setDescription('Provides information on avalible commands')
|
||||
|
||||
// Allow choosing the help page to open
|
||||
.addNumberOption(option =>
|
||||
option.setName('page')
|
||||
.setDescription('Choose help page to skip to'),
|
||||
),
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
let pageNumber = 1;
|
||||
let pageNumber = interaction.options.getNumber('page') ?? 1;
|
||||
const commandsPerPage = 5;
|
||||
let commandsThisPage = 0;
|
||||
|
||||
const numberOfCommands = Object.keys(helpFile).length;
|
||||
const pageTotal = String(Math.ceil(numberOfCommands / commandsPerPage));
|
||||
|
||||
if (pageNumber > pageTotal) {
|
||||
pageNumber = 1;
|
||||
}
|
||||
|
||||
let embedPartOne = {
|
||||
color: 0x0099ff,
|
||||
title: 'Help Text',
|
||||
|
@ -131,7 +142,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
// Button code
|
||||
const collector = interaction.channel.createMessageComponentCollector({ time: 30000 });
|
||||
const collector = interaction.channel.createMessageComponentCollector({ time: 60000 });
|
||||
|
||||
collector.on('collect', async i => {
|
||||
|
||||
|
|
Loading…
Reference in a new issue