Skip to content

Commit

Permalink
chore(style): format files
Browse files Browse the repository at this point in the history
  • Loading branch information
mezotv authored and github-actions[bot] committed Sep 8, 2023
1 parent 885268c commit dd8fc46
Show file tree
Hide file tree
Showing 15 changed files with 366 additions and 294 deletions.
5 changes: 3 additions & 2 deletions src/buttons/neverhaveiever.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ module.exports = {
"You don't have permission to use this button in this channel!",
ephemeral: true,
});
const { Funny, Basic, Young, Food, RuleBreak } =
await require(`../data/nhie-${guildDb.language}.json`);
const { Funny, Basic, Young, Food, RuleBreak } = await require(
`../data/nhie-${guildDb.language}.json`,
);
const dbquestions = guildDb.customMessages.filter(
(c) => c.type !== "nsfw" && c.type === "neverhaveiever",
);
Expand Down
87 changes: 47 additions & 40 deletions src/buttons/paginateFirst.js
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);
},
};
87 changes: 47 additions & 40 deletions src/buttons/paginateLast.js
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);
},
};
143 changes: 76 additions & 67 deletions src/buttons/paginateNext.js
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,
});
}
}
},
};
Loading

0 comments on commit dd8fc46

Please sign in to comment.