Skip to content

Commit

Permalink
I may be a slight idiot
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Jul 12, 2023
1 parent b77c1e1 commit 3abe73b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 26 deletions.
9 changes: 4 additions & 5 deletions src/commands/faithful/faq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ export const command: SlashCommand = {
if (choice == "all") {
if (
await interaction.perms({
type: "manager"
type: "manager",
})
)
return;

interaction.reply({ content: "** **", ephemeral: true, fetchReply: true })
.then((message: Message) => message.delete());
interaction.reply({ content: "** **", ephemeral: true });

let embedArray = [];
let i = 0;
Expand All @@ -35,8 +34,8 @@ export const command: SlashCommand = {
.setTitle(faq.question)
.setDescription(faq.answer)
.setColor(colors.brand)
.setFooter({ text: `Keywords: ${faq.keywords.join(" • ")}` })
)
.setFooter({ text: `Keywords: ${faq.keywords.join(" • ")}` }),
);

if ((i + 1) % 5 == 0) {
// groups the embeds in batches of 5 to reduce API spam
Expand Down
49 changes: 29 additions & 20 deletions src/commands/faithful/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export const command: SlashCommand = {
option
.setName("number")
.setDescription("Which rule to view")
.addChoices( // using the value as an array index
.addChoices(
// using the value as an array index
{ name: "1", value: "0" },
{ name: "2", value: "1" },
{ name: "3", value: "2" },
Expand All @@ -33,13 +34,19 @@ export const command: SlashCommand = {
if (choice == "all") {
if (await interaction.perms({ type: "manager" })) return;

interaction.reply({ content: "** **", ephemeral: true, fetchReply: true })
.then((message: Message) => message.delete());
interaction.reply({ content: "** **", ephemeral: true });

// I hate this so much but there's not much I can do
const thumbnail = interaction.guildId == (interaction.client as Client).config.discords.find((obj) => obj.name == "classic_faithful").id
? `${(interaction.client as Client).config.images}branding/logos/transparent/128/cf_plain_logo.png`
: `${(interaction.client as Client).config.images}branding/logos/transparent/128/plain_logo.png`;
const thumbnail =
interaction.guildId ==
(interaction.client as Client).config.discords.find((obj) => obj.name == "classic_faithful")
.id
? `${
(interaction.client as Client).config.images
}branding/logos/transparent/128/cf_plain_logo.png`
: `${
(interaction.client as Client).config.images
}branding/logos/transparent/128/plain_logo.png`;
let embedArray = [];
let i = 0;

Expand All @@ -49,17 +56,17 @@ export const command: SlashCommand = {
.setTitle(ruleStrings.rules_info.heading.title)
.setDescription(ruleStrings.rules_info.heading.description)
.setColor(colors.brand)
.setThumbnail(thumbnail)
]
})
.setThumbnail(thumbnail),
],
});

for (let rule of ruleStrings.rules) {
embedArray.push(
new MessageEmbed()
.setTitle(rule.title)
.setDescription(rule.description)
.setColor(colors.brand)
)
.setColor(colors.brand),
);

if ((i + 1) % 5 == 0) {
await interaction.channel.send({ embeds: embedArray });
Expand Down Expand Up @@ -91,14 +98,16 @@ export const command: SlashCommand = {
}

const ruleChoice = ruleStrings.rules[choice];
return await interaction.reply({
embeds: [
new MessageEmbed()
.setTitle(ruleChoice.title)
.setDescription(ruleChoice.description)
.setThumbnail(`${(interaction.client as Client).config.images}bot/rules.png`)
],
fetchReply: true,
}).then((message: Message) => message.deleteButton())
return await interaction
.reply({
embeds: [
new MessageEmbed()
.setTitle(ruleChoice.title)
.setDescription(ruleChoice.description)
.setThumbnail(`${(interaction.client as Client).config.images}bot/rules.png`),
],
fetchReply: true,
})
.then((message: Message) => message.deleteButton());
},
};
2 changes: 1 addition & 1 deletion src/helpers/permissions/slashCommandPermissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function checkPermissions(
type = "config";
permissions = {
roles: ["manager"],
}
};
default:
break;
}
Expand Down

0 comments on commit 3abe73b

Please sign in to comment.