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.
Merge formatting into main
- Loading branch information
Showing
131 changed files
with
13,796 additions
and
10,815 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
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; |
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,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; |
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,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; |
Oops, something went wrong.