fix: don't allow mentions

This commit is contained in:
Jozef Steinhübl 2024-05-10 16:13:35 +02:00
parent 4136d52f67
commit c7f7ddd1a3
No known key found for this signature in database
GPG key ID: E6BC90C91973B08F
5 changed files with 24 additions and 9 deletions

View file

@ -75,11 +75,12 @@ export default {
: "", : "",
].join("\n"); ].join("\n");
// @ts-expect-error allowed_mentions
await interaction.editReply({ await interaction.editReply({
content, content,
// allowedMentions: { allowed_mentions: {
// parse: ["users"], parse: target ? ["users"] : [],
// } },
}); });
}, },
} satisfies ApplicationCommand; } satisfies ApplicationCommand;

View file

@ -92,6 +92,7 @@ export default {
return; return;
} }
// @ts-expect-error allowed_mentions
interaction.editReply({ interaction.editReply({
content: [ content: [
`${result.emoji.type} ${result.emoji.state} [#${ `${result.emoji.type} ${result.emoji.state} [#${
@ -101,6 +102,9 @@ export default {
}>) ${stateToText(result)} ${stateToTimestamp(result)}`, }>) ${stateToText(result)} ${stateToTimestamp(result)}`,
result.title, result.title,
].join("\n"), ].join("\n"),
allowed_mentions: {
parse: [],
},
}); });
}, },

View file

@ -101,11 +101,15 @@ export default {
intro, intro,
]; ];
// @ts-expect-error allowed_mentions
await interaction.editReply({ await interaction.editReply({
content: [ content: [
target ? `*Suggestion for <@${target}>:*\n` : "", target ? `*Suggestion for <@${target}>:*\n` : "",
parts.join("\n"), parts.join("\n"),
].join("\n"), ].join("\n"),
allowed_mentions: {
parse: target ? ["users"] : [],
},
}); });
}, },
autocomplete: async (interaction) => { autocomplete: async (interaction) => {

View file

@ -32,15 +32,16 @@ export default {
}); });
} }
// @ts-expect-error allowed_mentions
await interaction.reply({ await interaction.reply({
content: [ content: [
target ? `*Suggestion for <@${target}>:*\n` : "", target ? `*Suggestion for <@${target}>:*\n` : "",
`**${tag.question}**`, `**${tag.question}**`,
tag.answer, tag.answer,
].join("\n"), ].join("\n"),
// allowedMentions: { allowed_mentions: {
// parse: ["users"] parse: target ? ["users"] : [],
// } },
}); });
}, },
autocomplete: async (interaction) => { autocomplete: async (interaction) => {

View file

@ -13,20 +13,25 @@ export default {
const tag = searchTag(await message.fetchChannel(), keyword, false); const tag = searchTag(await message.fetchChannel(), keyword, false);
if (!keyword || !tag) { if (!keyword || !tag) {
// @ts-expect-error allowed_mentions
return message.reply({ return message.reply({
content: `\`\` Could not find a tag \`${keyword}\``, content: `\`\` Could not find a tag \`${keyword}\``,
allowed_mentions: {
parse: [],
},
}); });
} }
// @ts-expect-error allowed_mentions
message.reply({ message.reply({
content: [ content: [
resolvedTarget ? `*Suggestion for <@${resolvedTarget.id}>:*\n` : "", resolvedTarget ? `*Suggestion for <@${resolvedTarget.id}>:*\n` : "",
`**${tag.question}**`, `**${tag.question}**`,
tag.answer, tag.answer,
].join("\n"), ].join("\n"),
// allowedMentions: { allowed_mentions: {
// parse: ["users"] parse: resolvedTarget ? ["users"] : [],
// } },
}); });
}, },
} satisfies MessageCommand; } satisfies MessageCommand;