feat: more advanced PSAs

This commit is contained in:
TrèsAbhi committed 2023-11-15 19:30:03 -06:00
1 parent 95f4dbf6a0
commit da56c563fc
2 files changed
+13 -2

No files matched your search

+1
View File
@@ -4,6 +4,7 @@ export type PSAData = {
title: string;
url: string;
}[];
commands?: string[];
} & (
| {
type: 'image';
@@ -43,7 +43,12 @@ export default async function handleChatInputCommand(
const reply = await normalizeInteractionReturnable(returnable!);
if (psa.data && !psa.data.secret) {
if (
psa.data &&
!psa.data.secret &&
(psa.data.commands === undefined ||
psa.data.commands.includes(interaction.commandName))
) {
if (psa.data.type === 'embed') {
if (!reply.embeds) reply.embeds = [];
reply.embeds.push(embedWarning(psa.data.title, psa.data.description));
@@ -66,7 +71,12 @@ export default async function handleChatInputCommand(
await interaction.editReply(reply);
if (psa.data && psa.data.secret) {
if (
psa.data &&
psa.data.secret &&
(psa.data.commands === undefined ||
psa.data.commands.includes(interaction.commandName))
) {
const followUp: InteractionReplyOptions = {
ephemeral: true,
};