Skip to content

Commit

Permalink
Merge formatting
Browse files Browse the repository at this point in the history
Merge formatting into main
  • Loading branch information
github-actions[bot] authored Nov 6, 2024
2 parents a524dcb + 5a0963b commit b54106c
Show file tree
Hide file tree
Showing 5 changed files with 280 additions and 246 deletions.
53 changes: 28 additions & 25 deletions src/buttons/replayFunctions/replayDelete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,34 @@ const button: Button = {
execute: async (interaction, client, guildDb) => {
const arr =
guildDb.replayChannels.filter(
(c) => c.id !== (interaction as any).values[0]
(c) => c.id !== (interaction as any).values[0],
).length > 0
? guildDb.replayChannels
: "None";

const generalMsg = new EmbedBuilder()
.setTitle(
client.translation.get(guildDb?.language, "Settings.embed.generalTitle")
client.translation.get(
guildDb?.language,
"Settings.embed.generalTitle",
),
)
.setDescription(
`${client.translation.get(
guildDb?.language,
"Settings.embed.replayType"
"Settings.embed.replayType",
)}: ${guildDb.replayType}\n${client.translation.get(
guildDb?.language,
"Settings.embed.replayBy"
"Settings.embed.replayBy",
)}: ${guildDb.replayBy}\n${
guildDb.replayBy === "Guild"
? client.translation.get(
guildDb?.language,
"Settings.embed.replayBy2"
"Settings.embed.replayBy2",
)
: client.translation.get(
guildDb?.language,
"Settings.embed.replayBy1"
"Settings.embed.replayBy1",
)
}\n${client.translation.get(guildDb?.language, "Settings.embed.replayChannels")}: ${
arr === "None"
Expand All @@ -47,13 +50,13 @@ const button: Button = {
.filter((c) => c.id !== (interaction as any).values[0])
.map((c) => `<#${c.id}>: ${Number(c.cooldown) / 1000}s`)
.join("\n")}`
}`
}`,
)
.setColor("#0598F6")
.setFooter({
text: client.translation.get(
guildDb?.language,
"Settings.embed.footer"
"Settings.embed.footer",
),
iconURL: client?.user?.displayAvatarURL() || undefined,
});
Expand All @@ -65,8 +68,8 @@ const button: Button = {
.setLabel(
client.translation.get(
guildDb?.language,
"Settings.button.replayType"
)
"Settings.button.replayType",
),
)
.setStyle(ButtonStyle.Primary)
.setEmoji("1207774450658050069"),
Expand All @@ -75,11 +78,11 @@ const button: Button = {
.setLabel(
client.translation.get(
guildDb?.language,
"Settings.button.replayBy"
)
"Settings.button.replayBy",
),
)
.setStyle(ButtonStyle.Primary)
.setEmoji("1207778786976989244")
.setEmoji("1207778786976989244"),
);

let setDeleteButtons: ActionRowBuilder<MessageActionRowComponentBuilder>;
Expand All @@ -90,30 +93,30 @@ const button: Button = {
.setCustomId(
guildDb.replayType === "Channels"
? "replayChannels"
: "replayCooldown"
: "replayCooldown",
)
.setEmoji("1185973661736374405")
.setLabel(
client.translation.get(
guildDb?.language,
"Settings.button.replayCooldown"
)
"Settings.button.replayCooldown",
),
)
.setStyle(
guildDb.replayCooldown
? ButtonStyle.Success
: ButtonStyle.Secondary
: ButtonStyle.Secondary,
),
new ButtonBuilder()
.setCustomId("replayDeleteChannels")
.setEmoji("1207774452230787182")
.setLabel(
client.translation.get(
guildDb?.language,
"Settings.button.replayDeleteChannels"
)
"Settings.button.replayDeleteChannels",
),
)
.setStyle(ButtonStyle.Danger)
.setStyle(ButtonStyle.Danger),
);
} else {
setDeleteButtons =
Expand All @@ -124,19 +127,19 @@ const button: Button = {
.setLabel(
client.translation.get(
guildDb?.language,
"Settings.button.replayCooldown"
)
"Settings.button.replayCooldown",
),
)
.setStyle(
guildDb.replayCooldown
? ButtonStyle.Success
: ButtonStyle.Secondary
)
: ButtonStyle.Secondary,
),
);
}

guildDb.replayChannels = guildDb.replayChannels.filter(
(c) => c.id !== (interaction as any).values[0]
(c) => c.id !== (interaction as any).values[0],
);

await client.database.updateGuild(interaction.guild?.id || "", {
Expand Down
51 changes: 27 additions & 24 deletions src/buttons/replayFunctions/replayType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,49 +14,52 @@ const button: Button = {
const newType = guildDb.replayType === "Channels" ? "Guild" : "Channels";
const generalMsg = new EmbedBuilder()
.setTitle(
client.translation.get(guildDb?.language, "Settings.embed.generalTitle")
client.translation.get(
guildDb?.language,
"Settings.embed.generalTitle",
),
)
.setDescription(
`${client.translation.get(
guildDb?.language,
"Settings.embed.replayType"
"Settings.embed.replayType",
)}: ${newType}\n${client.translation.get(guildDb?.language, "Settings.embed.replayBy")}: ${guildDb.replayBy}\n${
guildDb.replayBy === "Guild"
? client.translation.get(
guildDb?.language,
"Settings.embed.replayBy2"
"Settings.embed.replayBy2",
)
: client.translation.get(
guildDb?.language,
"Settings.embed.replayBy1"
"Settings.embed.replayBy1",
)
}\n${
guildDb.replayType === "Channels"
? `${client.translation.get(
guildDb?.language,
"Settings.embed.replayCooldown"
"Settings.embed.replayCooldown",
)}: ${guildDb.replayCooldown / 1000}s`
: `${client.translation.get(guildDb?.language, "Settings.embed.replayChannels")}: ${
guildDb.replayChannels.length > 0
? `\n${guildDb.replayChannels
.sort(
(a: any, b: any) =>
b.cooldown / 1000 - a.cooldown / 1000
b.cooldown / 1000 - a.cooldown / 1000,
)
.map((c) => `<#${c.id}>: ${Number(c.cooldown) / 1000}s`)
.join("\n")}`
: client.translation.get(
guildDb?.language,
"Settings.embed.replayChannelsNone"
"Settings.embed.replayChannelsNone",
)
}`
}`
}`,
)
.setColor("#0598F6")
.setFooter({
text: client.translation.get(
guildDb?.language,
"Settings.embed.footer"
"Settings.embed.footer",
),
iconURL: client?.user?.displayAvatarURL() || undefined,
});
Expand All @@ -68,8 +71,8 @@ const button: Button = {
.setLabel(
client.translation.get(
guildDb?.language,
"Settings.button.replayType"
)
"Settings.button.replayType",
),
)
.setStyle(ButtonStyle.Primary)
.setEmoji("1207774450658050069"),
Expand All @@ -78,11 +81,11 @@ const button: Button = {
.setLabel(
client.translation.get(
guildDb?.language,
"Settings.button.replayBy"
)
"Settings.button.replayBy",
),
)
.setStyle(ButtonStyle.Primary)
.setEmoji("1207778786976989244")
.setEmoji("1207778786976989244"),
);

let setDeleteButtons: ActionRowBuilder<MessageActionRowComponentBuilder>;
Expand All @@ -95,24 +98,24 @@ const button: Button = {
.setLabel(
client.translation.get(
guildDb?.language,
"Settings.button.replayCooldown"
)
"Settings.button.replayCooldown",
),
)
.setStyle(
guildDb.replayCooldown
? ButtonStyle.Success
: ButtonStyle.Secondary
: ButtonStyle.Secondary,
),
new ButtonBuilder()
.setCustomId("replayDeleteChannels")
.setEmoji("1207774452230787182")
.setLabel(
client.translation.get(
guildDb?.language,
"Settings.button.replayDeleteChannels"
)
"Settings.button.replayDeleteChannels",
),
)
.setStyle(ButtonStyle.Danger)
.setStyle(ButtonStyle.Danger),
);
} else {
setDeleteButtons =
Expand All @@ -123,14 +126,14 @@ const button: Button = {
.setLabel(
client.translation.get(
guildDb?.language,
"Settings.button.replayCooldown"
)
"Settings.button.replayCooldown",
),
)
.setStyle(
guildDb.replayCooldown
? ButtonStyle.Success
: ButtonStyle.Secondary
)
: ButtonStyle.Secondary,
),
);
}
await client.database.updateGuild(interaction.guild?.id || "", {
Expand Down
Loading

0 comments on commit b54106c

Please sign in to comment.