mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 03:29:51 +01:00
feat: lenient psa
This commit is contained in:
1 parent
f02db6ef0b
commit
ab26b346e6
2 files changed
+20
-13
No files matched your search
@@ -6,16 +6,17 @@ export type PSAData = {
|
|||||||
}[];
|
}[];
|
||||||
commands?: string[];
|
commands?: string[];
|
||||||
} & (
|
} & (
|
||||||
|
| {
|
||||||
|
type?: 'embed';
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
image?: string;
|
||||||
|
}
|
||||||
| {
|
| {
|
||||||
type: 'image';
|
type: 'image';
|
||||||
image: string;
|
image: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
}
|
}
|
||||||
| {
|
|
||||||
type: 'embed';
|
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
export interface PSA {
|
export interface PSA {
|
||||||
|
|||||||
@@ -63,10 +63,14 @@ export default async function handleChatInputCommand(
|
|||||||
(psa.data.commands === undefined ||
|
(psa.data.commands === undefined ||
|
||||||
psa.data.commands.includes(interaction.commandName))
|
psa.data.commands.includes(interaction.commandName))
|
||||||
) {
|
) {
|
||||||
if (psa.data.type === 'embed') {
|
if (psa.data.type === undefined || psa.data.type === 'embed') {
|
||||||
if (!reply.embeds) reply.embeds = [];
|
if (!reply.embeds) reply.embeds = [];
|
||||||
reply.embeds.push(embedWarning(psa.data.title, psa.data.description));
|
|
||||||
} else {
|
const embed = embedWarning(psa.data.title, psa.data.description);
|
||||||
|
|
||||||
|
if (psa.data.image) embed.setImage(psa.data.image);
|
||||||
|
reply.embeds.push(embed);
|
||||||
|
} else if (psa.data.type === 'image') {
|
||||||
if (!reply.files) reply.files = [];
|
if (!reply.files) reply.files = [];
|
||||||
reply.files.push(new AttachmentBuilder(psa.data.image));
|
reply.files.push(new AttachmentBuilder(psa.data.image));
|
||||||
reply.content = reply.content ?? psa.data.title;
|
reply.content = reply.content ?? psa.data.title;
|
||||||
@@ -101,12 +105,14 @@ export default async function handleChatInputCommand(
|
|||||||
ephemeral: true,
|
ephemeral: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (psa.data.type === 'embed') {
|
if (psa.data.type === undefined || psa.data.type === 'embed') {
|
||||||
if (!followUp.embeds) followUp.embeds = [];
|
if (!followUp.embeds) followUp.embeds = [];
|
||||||
followUp.embeds.push(
|
|
||||||
embedWarning(psa.data.title, psa.data.description),
|
const embed = embedWarning(psa.data.title, psa.data.description);
|
||||||
);
|
|
||||||
} else {
|
if (psa.data.image) embed.setImage(psa.data.image);
|
||||||
|
followUp.embeds.push(embed);
|
||||||
|
} else if (psa.data.type === 'image') {
|
||||||
if (!followUp.files) followUp.files = [];
|
if (!followUp.files) followUp.files = [];
|
||||||
followUp.files.push(new AttachmentBuilder(psa.data.image));
|
followUp.files.push(new AttachmentBuilder(psa.data.image));
|
||||||
followUp.content = followUp.content ?? psa.data.title;
|
followUp.content = followUp.content ?? psa.data.title;
|
||||||
|
|||||||
Reference in new issue
Block a user