feat: some more type prefixes

This commit is contained in:
TrèsAbhi committed 2025-10-13 23:20:26 -05:00
1 parent 0d8cb5c1ae
commit 26304fc281
71 files changed
+411 -409

No files matched your search

@@ -3,21 +3,21 @@ import {
AttachmentBuilder,
ButtonBuilder,
ButtonStyle,
CacheType,
type CacheType,
ChatInputCommandInteraction,
InteractionReplyOptions,
} from 'discord.js';
import { InteractionRawReturnable, commands } from '..';
import { UserError } from '../../../core/blitzkit/userError';
import { buttonLink } from '../../../core/discord/buttonLink';
import { embedWarning } from '../../../core/discord/embedWarning';
import { normalizeInteractionReturnable } from '../../../core/discord/normalizeInteractionReturnable';
import { psa } from '../../../core/discord/psa';
import { translator } from '../../../core/localization/translator';
import { Writeable } from '../../../types/writable';
type InteractionReplyOptions,
} from "discord.js";
import { type InteractionRawReturnable, commands } from "..";
import { UserError } from "../../../core/blitzkit/userError";
import { buttonLink } from "../../../core/discord/buttonLink";
import { embedWarning } from "../../../core/discord/embedWarning";
import { normalizeInteractionReturnable } from "../../../core/discord/normalizeInteractionReturnable";
import { psa } from "../../../core/discord/psa";
import { translator } from "../../../core/localization/translator";
import type { Writeable } from "../../../types/writable";
export async function handleChatInputCommand(
interaction: ChatInputCommandInteraction<CacheType>,
interaction: ChatInputCommandInteraction<CacheType>
) {
await interaction.deferReply();
@@ -33,10 +33,10 @@ export async function handleChatInputCommand(
(Array.isArray(returnable) ? returnable : [returnable]).forEach(
(object) => {
if (typeof object === 'string') {
if (typeof object === "string") {
chunks.push([object]);
} else chunks.at(-1)?.push(object!);
},
}
);
let index = 0;
@@ -49,17 +49,17 @@ export async function handleChatInputCommand(
(psa.data.commands === undefined ||
psa.data.commands.includes(interaction.commandName))
) {
if (psa.data.type === undefined || psa.data.type === 'embed') {
if (psa.data.type === undefined || psa.data.type === "embed") {
if (!reply.embeds) reply.embeds = [];
const embed = embedWarning(psa.data.title, psa.data.description);
if (psa.data.image) embed.setImage(psa.data.image);
(reply.embeds as Writeable<typeof reply.embeds>).push(embed);
} else if (psa.data.type === 'image') {
} else if (psa.data.type === "image") {
if (!reply.files) reply.files = [];
(reply.files as Writeable<typeof reply.files>).push(
new AttachmentBuilder(psa.data.image),
new AttachmentBuilder(psa.data.image)
);
reply.content = reply.content ?? psa.data.title;
}
@@ -72,7 +72,7 @@ export async function handleChatInputCommand(
(
reply.components[0] as ActionRowBuilder<ButtonBuilder>
).addComponents(
psa.data.links.map(({ title, url }) => buttonLink(url, title)),
psa.data.links.map(({ title, url }) => buttonLink(url, title))
);
}
}
@@ -93,17 +93,17 @@ export async function handleChatInputCommand(
ephemeral: true,
};
if (psa.data.type === undefined || psa.data.type === 'embed') {
if (psa.data.type === undefined || psa.data.type === "embed") {
if (!followUp.embeds) followUp.embeds = [];
const embed = embedWarning(psa.data.title, psa.data.description);
if (psa.data.image) embed.setImage(psa.data.image);
(followUp.embeds as Writeable<typeof followUp.embeds>).push(embed);
} else if (psa.data.type === 'image') {
} else if (psa.data.type === "image") {
if (!followUp.files) followUp.files = [];
(followUp.files as Writeable<typeof followUp.files>).push(
new AttachmentBuilder(psa.data.image),
new AttachmentBuilder(psa.data.image)
);
followUp.content = followUp.content ?? psa.data.title;
}
@@ -116,7 +116,7 @@ export async function handleChatInputCommand(
(
followUp.components[0] as ActionRowBuilder<ButtonBuilder>
).addComponents(
psa.data.links.map(({ title, url }) => buttonLink(url, title)),
psa.data.links.map(({ title, url }) => buttonLink(url, title))
);
}
@@ -132,8 +132,8 @@ export async function handleChatInputCommand(
new ActionRowBuilder<ButtonBuilder>().addComponents(
new ButtonBuilder()
.setLabel(strings.bot.common.errors.get_help)
.setURL('https://discord.gg/nDt7AjGJQH')
.setStyle(ButtonStyle.Link),
.setURL("https://discord.gg/nDt7AjGJQH")
.setStyle(ButtonStyle.Link)
),
];
if (error instanceof UserError) {
@@ -4,15 +4,15 @@ import {
AutocompleteInteraction,
ButtonBuilder,
ButtonInteraction,
CacheType,
type CacheType,
ChatInputCommandInteraction,
EmbedBuilder,
Interaction,
type Interaction,
REST,
Routes,
SlashCommandBuilder,
SlashCommandOptionsOnlyBuilder,
SlashCommandSubcommandsOnlyBuilder,
type SlashCommandOptionsOnlyBuilder,
type SlashCommandSubcommandsOnlyBuilder,
} from "discord.js";
import { aboutCommand } from "../../commands/about";
import { breakdownCommand } from "../../commands/breakdown";