generated from mezotv/Discord-Bot-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
885268c
commit dd8fc46
Showing
15 changed files
with
366 additions
and
294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,53 @@ | ||
const { ButtonBuilder, ActionRowBuilder, EmbedBuilder } = require("discord.js"); | ||
module.exports = { | ||
data: { | ||
name: "paginateFirst", | ||
description: "Pagination first", | ||
}, | ||
async execute(interaction, client, guildDb) { | ||
const paginate = client.paginate.get(interaction.user.id); | ||
if (!paginate) return interaction.reply({ content: client.translation.get(guildDb?.language, "wyCustom.error.issue"), ephemeral: true }) | ||
data: { | ||
name: "paginateFirst", | ||
description: "Pagination first", | ||
}, | ||
async execute(interaction, client, guildDb) { | ||
const paginate = client.paginate.get(interaction.user.id); | ||
if (!paginate) | ||
return interaction.reply({ | ||
content: client.translation.get( | ||
guildDb?.language, | ||
"wyCustom.error.issue", | ||
), | ||
ephemeral: true, | ||
}); | ||
|
||
const buttons = new ActionRowBuilder() | ||
.addComponents( | ||
new ButtonBuilder() | ||
.setDisabled(true) | ||
.setCustomId("paginateFirst") | ||
.setLabel("⏪") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setDisabled(true) | ||
.setCustomId("paginatePrev") | ||
.setLabel("◀️") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setCustomId("paginateNext") | ||
.setLabel("▶️") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setCustomId("paginateLast") | ||
.setLabel("⏩") | ||
.setStyle("Secondary"), | ||
); | ||
const buttons = new ActionRowBuilder().addComponents( | ||
new ButtonBuilder() | ||
.setDisabled(true) | ||
.setCustomId("paginateFirst") | ||
.setLabel("⏪") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setDisabled(true) | ||
.setCustomId("paginatePrev") | ||
.setLabel("◀️") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setCustomId("paginateNext") | ||
.setLabel("▶️") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setCustomId("paginateLast") | ||
.setLabel("⏩") | ||
.setStyle("Secondary"), | ||
); | ||
|
||
await interaction.update({ | ||
embeds: [paginate.pages[0]], | ||
components: [buttons], | ||
ephemeral: true, | ||
}); | ||
|
||
await interaction.update({ | ||
embeds: [paginate.pages[0]], | ||
components: [buttons], | ||
ephemeral: true, | ||
}); | ||
clearTimeout(paginate.timeout); | ||
const time = setTimeout(() => { | ||
if (client.paginate.get(this.user)) client.paginate.delete(this.user); | ||
}, paginate.time); | ||
paginate.timeout = time; | ||
|
||
clearTimeout(paginate.timeout); | ||
const time = setTimeout(() => { if (client.paginate.get(this.user)) client.paginate.delete(this.user); }, paginate.time); | ||
paginate.timeout = time; | ||
|
||
return (paginate.page = 0); | ||
} | ||
} | ||
return (paginate.page = 0); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,53 @@ | ||
const { ButtonBuilder, ActionRowBuilder, EmbedBuilder } = require("discord.js"); | ||
module.exports = { | ||
data: { | ||
name: "paginateLast", | ||
description: "Paginate last", | ||
}, | ||
async execute(interaction, client, guildDb) { | ||
const paginate = client.paginate.get(interaction.user.id); | ||
if (!paginate) return interaction.reply({ content: client.translation.get(guildDb?.language, "wyCustom.error.issue"), ephemeral: true }) | ||
data: { | ||
name: "paginateLast", | ||
description: "Paginate last", | ||
}, | ||
async execute(interaction, client, guildDb) { | ||
const paginate = client.paginate.get(interaction.user.id); | ||
if (!paginate) | ||
return interaction.reply({ | ||
content: client.translation.get( | ||
guildDb?.language, | ||
"wyCustom.error.issue", | ||
), | ||
ephemeral: true, | ||
}); | ||
|
||
const buttons = new ActionRowBuilder() | ||
.addComponents( | ||
new ButtonBuilder() | ||
.setCustomId("paginateFirst") | ||
.setLabel("⏪") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setCustomId("paginatePrev") | ||
.setLabel("◀️") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setDisabled(true) | ||
.setCustomId("paginateNext") | ||
.setLabel("▶️") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setDisabled(true) | ||
.setCustomId("paginateLast") | ||
.setLabel("⏩") | ||
.setStyle("Secondary"), | ||
); | ||
const buttons = new ActionRowBuilder().addComponents( | ||
new ButtonBuilder() | ||
.setCustomId("paginateFirst") | ||
.setLabel("⏪") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setCustomId("paginatePrev") | ||
.setLabel("◀️") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setDisabled(true) | ||
.setCustomId("paginateNext") | ||
.setLabel("▶️") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setDisabled(true) | ||
.setCustomId("paginateLast") | ||
.setLabel("⏩") | ||
.setStyle("Secondary"), | ||
); | ||
|
||
await interaction.update({ | ||
embeds: [paginate.pages[paginate.pages.length - 1]], | ||
components: [buttons], | ||
ephemeral: true, | ||
}); | ||
|
||
await interaction.update({ | ||
embeds: [paginate.pages[paginate.pages.length - 1]], | ||
components: [buttons], | ||
ephemeral: true, | ||
}); | ||
clearTimeout(paginate.timeout); | ||
const time = setTimeout(() => { | ||
if (client.paginate.get(this.user)) client.paginate.delete(this.user); | ||
}, paginate.time); | ||
paginate.timeout = time; | ||
|
||
clearTimeout(paginate.timeout); | ||
const time = setTimeout(() => { if (client.paginate.get(this.user)) client.paginate.delete(this.user); }, paginate.time); | ||
paginate.timeout = time; | ||
|
||
return (paginate.page = paginate.pages.length - 1); | ||
} | ||
} | ||
return (paginate.page = paginate.pages.length - 1); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,84 @@ | ||
const { ButtonBuilder, ActionRowBuilder, EmbedBuilder } = require("discord.js"); | ||
module.exports = { | ||
data: { | ||
name: "paginateNext", | ||
description: "Paginate next", | ||
}, | ||
async execute(interaction, client, guildDb) { | ||
const paginate = client.paginate.get(interaction.user.id); | ||
if (!paginate) return interaction.reply({ content: client.translation.get(guildDb?.language, "wyCustom.error.issue"), ephemeral: true }) | ||
data: { | ||
name: "paginateNext", | ||
description: "Paginate next", | ||
}, | ||
async execute(interaction, client, guildDb) { | ||
const paginate = client.paginate.get(interaction.user.id); | ||
if (!paginate) | ||
return interaction.reply({ | ||
content: client.translation.get( | ||
guildDb?.language, | ||
"wyCustom.error.issue", | ||
), | ||
ephemeral: true, | ||
}); | ||
|
||
if ((paginate.page + 1) === (paginate.pages.length - 1)) { | ||
const buttons = new ActionRowBuilder() | ||
.addComponents( | ||
new ButtonBuilder() | ||
.setCustomId("paginateFirst") | ||
.setLabel("⏪") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setCustomId("paginatePrev") | ||
.setLabel("◀️") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setDisabled(true) | ||
.setCustomId("paginateNext") | ||
.setLabel("▶️") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setDisabled(true) | ||
.setCustomId("paginateLast") | ||
.setLabel("⏩") | ||
.setStyle("Secondary"), | ||
); | ||
if (paginate.page + 1 === paginate.pages.length - 1) { | ||
const buttons = new ActionRowBuilder().addComponents( | ||
new ButtonBuilder() | ||
.setCustomId("paginateFirst") | ||
.setLabel("⏪") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setCustomId("paginatePrev") | ||
.setLabel("◀️") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setDisabled(true) | ||
.setCustomId("paginateNext") | ||
.setLabel("▶️") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setDisabled(true) | ||
.setCustomId("paginateLast") | ||
.setLabel("⏩") | ||
.setStyle("Secondary"), | ||
); | ||
|
||
clearTimeout(paginate.timeout); | ||
const time = setTimeout(() => { if (client.paginate.get(this.user)) client.paginate.delete(this.user); }, paginate.time); | ||
paginate.timeout = time; | ||
clearTimeout(paginate.timeout); | ||
const time = setTimeout(() => { | ||
if (client.paginate.get(this.user)) client.paginate.delete(this.user); | ||
}, paginate.time); | ||
paginate.timeout = time; | ||
|
||
return await interaction.update({ | ||
embeds: [paginate.pages[++paginate.page]], | ||
components: [buttons], | ||
ephemeral: true, | ||
}); | ||
} else { | ||
const buttons = new ActionRowBuilder() | ||
.addComponents( | ||
new ButtonBuilder() | ||
.setCustomId("paginateFirst") | ||
.setLabel("⏪") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setCustomId("paginatePrev") | ||
.setLabel("◀️") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setCustomId("paginateNext") | ||
.setLabel("▶️") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setCustomId("paginateLast") | ||
.setLabel("⏩") | ||
.setStyle("Secondary"), | ||
); | ||
return await interaction.update({ | ||
embeds: [paginate.pages[++paginate.page]], | ||
components: [buttons], | ||
ephemeral: true, | ||
}); | ||
} else { | ||
const buttons = new ActionRowBuilder().addComponents( | ||
new ButtonBuilder() | ||
.setCustomId("paginateFirst") | ||
.setLabel("⏪") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setCustomId("paginatePrev") | ||
.setLabel("◀️") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setCustomId("paginateNext") | ||
.setLabel("▶️") | ||
.setStyle("Secondary"), | ||
new ButtonBuilder() | ||
.setCustomId("paginateLast") | ||
.setLabel("⏩") | ||
.setStyle("Secondary"), | ||
); | ||
|
||
clearTimeout(paginate.timeout); | ||
const time = setTimeout(() => { if (client.paginate.get(this.user)) client.paginate.delete(this.user); }, paginate.time); | ||
paginate.timeout = time; | ||
clearTimeout(paginate.timeout); | ||
const time = setTimeout(() => { | ||
if (client.paginate.get(this.user)) client.paginate.delete(this.user); | ||
}, paginate.time); | ||
paginate.timeout = time; | ||
|
||
return await interaction.update({ | ||
embeds: [paginate.pages[++paginate.page]], | ||
components: [buttons], | ||
ephemeral: true, | ||
}); | ||
} | ||
return await interaction.update({ | ||
embeds: [paginate.pages[++paginate.page]], | ||
components: [buttons], | ||
ephemeral: true, | ||
}); | ||
} | ||
} | ||
}, | ||
}; |
Oops, something went wrong.