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 Oct 5, 2024
2 parents 290bdac + d7c3811 commit a0e7acc
Show file tree
Hide file tree
Showing 131 changed files with 13,796 additions and 10,815 deletions.
69 changes: 44 additions & 25 deletions src/buttons/customQuestions/wycustom_accept.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,53 @@
import { ActionRowBuilder, ButtonBuilder, EmbedBuilder, type MessageActionRowComponentBuilder } from "discord.js";
import {
ActionRowBuilder,
ButtonBuilder,
EmbedBuilder,
type MessageActionRowComponentBuilder,
} from "discord.js";
import type { Button } from "../../interfaces";

const button: Button = {
name: "wycustom_accept",
cooldown: false,
execute: async (interaction, client, guildDb) => {
const typeEmbed = new EmbedBuilder()
.setTitle(client.translation.get(guildDb?.language, "wyCustom.success.embedRemoveAll.accept"))
.setColor("#0598F4")
.setFooter({
text: "Would You",
iconURL: client?.user?.displayAvatarURL() || undefined,
});
name: "wycustom_accept",
cooldown: false,
execute: async (interaction, client, guildDb) => {
const typeEmbed = new EmbedBuilder()
.setTitle(
client.translation.get(
guildDb?.language,
"wyCustom.success.embedRemoveAll.accept",
),
)
.setColor("#0598F4")
.setFooter({
text: "Would You",
iconURL: client?.user?.displayAvatarURL() || undefined,
});

const button = new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents(
new ButtonBuilder().setLabel("Accept").setStyle(4).setDisabled(true).setCustomId("accept"),
new ButtonBuilder().setLabel("Decline").setStyle(2).setDisabled(true).setCustomId("decline"),
);
const button =
new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents(
new ButtonBuilder()
.setLabel("Accept")
.setStyle(4)
.setDisabled(true)
.setCustomId("accept"),
new ButtonBuilder()
.setLabel("Decline")
.setStyle(2)
.setDisabled(true)
.setCustomId("decline"),
);

await client.database.updateGuild(interaction.guild?.id || "", {
...guildDb,
customMessages: [],
});
await client.database.updateGuild(interaction.guild?.id || "", {
...guildDb,
customMessages: [],
});

interaction.update({
embeds: [typeEmbed],
components: [button],
});
return;
},
interaction.update({
embeds: [typeEmbed],
components: [button],
});
return;
},
};

export default button;
158 changes: 94 additions & 64 deletions src/buttons/customQuestions/wycustom_add.ts
Original file line number Diff line number Diff line change
@@ -1,75 +1,105 @@
import { ActionRowBuilder, ButtonBuilder, EmbedBuilder, type MessageActionRowComponentBuilder } from "discord.js";
import {
ActionRowBuilder,
ButtonBuilder,
EmbedBuilder,
type MessageActionRowComponentBuilder,
} from "discord.js";
import type { Button } from "../../interfaces";

const button: Button = {
name: "wycustom_add",
cooldown: false,
execute: async (interaction, client, guildDb) => {
try {
const id = interaction.customId.replace("-", ":").split(":")[1];
const data = client.customAdd.get(id);
if (!data) {
interaction.deferUpdate();
return;
}
name: "wycustom_add",
cooldown: false,
execute: async (interaction, client, guildDb) => {
try {
const id = interaction.customId.replace("-", ":").split(":")[1];
const data = client.customAdd.get(id);
if (!data) {
interaction.deferUpdate();
return;
}

const typeEmbed = new EmbedBuilder()
.setTitle(client.translation.get(guildDb?.language, "wyCustom.success.embedAdd.title"))
.setColor("#0598F4")
.setDescription(
`${client.translation.get(guildDb?.language, "wyCustom.success.embedAdd.success", {
type:
data?.type === "wouldyourather"
? client.translation.get(guildDb?.language, "wyCustom.success.embedAdd.descWYR")
: data?.type === "wwyd"
? client.translation.get(guildDb?.language, "wyCustom.success.embedAdd.descWWYD")
: client.translation.get(guildDb?.language, "wyCustom.success.embedAdd.descNHIE"),
})}\n\n**${client.translation.get(
guildDb?.language,
"wyCustom.success.embedAdd.descID",
)}**: ${id}\n**${client.translation.get(
guildDb?.language,
"wyCustom.success.embedAdd.descCat",
)}**: ${data.type}\n\n**${client.translation.get(
guildDb?.language,
"wyCustom.success.embedAdd.descCont",
)}**: \`${data.text}\``,
)
.setFooter({
text: "Would You",
iconURL: client?.user?.displayAvatarURL() || undefined,
});
const typeEmbed = new EmbedBuilder()
.setTitle(
client.translation.get(
guildDb?.language,
"wyCustom.success.embedAdd.title",
),
)
.setColor("#0598F4")
.setDescription(
`${client.translation.get(
guildDb?.language,
"wyCustom.success.embedAdd.success",
{
type:
data?.type === "wouldyourather"
? client.translation.get(
guildDb?.language,
"wyCustom.success.embedAdd.descWYR",
)
: data?.type === "wwyd"
? client.translation.get(
guildDb?.language,
"wyCustom.success.embedAdd.descWWYD",
)
: client.translation.get(
guildDb?.language,
"wyCustom.success.embedAdd.descNHIE",
),
},
)}\n\n**${client.translation.get(
guildDb?.language,
"wyCustom.success.embedAdd.descID",
)}**: ${id}\n**${client.translation.get(
guildDb?.language,
"wyCustom.success.embedAdd.descCat",
)}**: ${data.type}\n\n**${client.translation.get(
guildDb?.language,
"wyCustom.success.embedAdd.descCont",
)}**: \`${data.text}\``,
)
.setFooter({
text: "Would You",
iconURL: client?.user?.displayAvatarURL() || undefined,
});

const button = new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents(
new ButtonBuilder().setLabel("Add").setStyle(1).setDisabled(true).setCustomId("add"),
);
const button =
new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents(
new ButtonBuilder()
.setLabel("Add")
.setStyle(1)
.setDisabled(true)
.setCustomId("add"),
);

const filtered = guildDb.customMessages.filter((c) => c.id.toString() !== id);
filtered.push({
id: id,
question: data.text,
type: data.type,
});
const filtered = guildDb.customMessages.filter(
(c) => c.id.toString() !== id,
);
filtered.push({
id: id,
question: data.text,
type: data.type,
});

await client.database.updateGuild(
interaction.guildId || "",
{
...guildDb,
customMessages: filtered,
},
true,
);
await client.database.updateGuild(
interaction.guildId || "",
{
...guildDb,
customMessages: filtered,
},
true,
);

client.customAdd.delete(id);
interaction.update({
embeds: [typeEmbed],
components: [button],
});
return;
} catch (e) {
console.log(e);
}
},
client.customAdd.delete(id);
interaction.update({
embeds: [typeEmbed],
components: [button],
});
return;
} catch (e) {
console.log(e);
}
},
};

export default button;
61 changes: 40 additions & 21 deletions src/buttons/customQuestions/wycustom_decline.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,48 @@
import { ActionRowBuilder, ButtonBuilder, EmbedBuilder, type MessageActionRowComponentBuilder } from "discord.js";
import {
ActionRowBuilder,
ButtonBuilder,
EmbedBuilder,
type MessageActionRowComponentBuilder,
} from "discord.js";
import type { Button } from "../../interfaces";

const button: Button = {
name: "wycustom_decline",
cooldown: false,
execute: async (interaction, client, guildDb) => {
const typeEmbed = new EmbedBuilder()
.setTitle(client.translation.get(guildDb?.language, "wyCustom.success.embedRemoveAll.decline"))
.setColor("#0598F4")
.setFooter({
text: "Would You",
iconURL: client?.user?.displayAvatarURL() || undefined,
});
name: "wycustom_decline",
cooldown: false,
execute: async (interaction, client, guildDb) => {
const typeEmbed = new EmbedBuilder()
.setTitle(
client.translation.get(
guildDb?.language,
"wyCustom.success.embedRemoveAll.decline",
),
)
.setColor("#0598F4")
.setFooter({
text: "Would You",
iconURL: client?.user?.displayAvatarURL() || undefined,
});

const button = new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents(
new ButtonBuilder().setLabel("Accept").setStyle(4).setDisabled(true).setCustomId("accept"),
new ButtonBuilder().setLabel("Decline").setStyle(2).setDisabled(true).setCustomId("decline"),
);
const button =
new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents(
new ButtonBuilder()
.setLabel("Accept")
.setStyle(4)
.setDisabled(true)
.setCustomId("accept"),
new ButtonBuilder()
.setLabel("Decline")
.setStyle(2)
.setDisabled(true)
.setCustomId("decline"),
);

interaction.update({
embeds: [typeEmbed],
components: [button],
});
return;
},
interaction.update({
embeds: [typeEmbed],
components: [button],
});
return;
},
};

export default button;
Loading

0 comments on commit a0e7acc

Please sign in to comment.