mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-19 01:03:58 +00:00
feat(bots/discord)!: allow message scan response to be message payloads
This commit is contained in:
@@ -24,16 +24,19 @@ export const createSuccessEmbed = (title: string | null, description?: string) =
|
||||
)
|
||||
|
||||
export const createMessageScanResponseEmbed = (
|
||||
response: ConfigMessageScanResponseMessage,
|
||||
response: NonNullable<ConfigMessageScanResponseMessage['embeds']>[number],
|
||||
mode: 'ocr' | 'nlp' | 'match',
|
||||
) => {
|
||||
// biome-ignore lint/style/noParameterAssign: While this is confusing, it is fine for this purpose
|
||||
if ('toJSON' in response) response = response.toJSON()
|
||||
|
||||
const embed = new EmbedBuilder().setTitle(response.title ?? null)
|
||||
|
||||
if (response.description) embed.setDescription(response.description)
|
||||
if (response.fields) embed.addFields(response.fields)
|
||||
|
||||
embed.setFooter({
|
||||
text: `ReVanced • Done via ${MessageScanHumanizedMode[mode]}`,
|
||||
text: `ReVanced • Via ${MessageScanHumanizedMode[mode]}`,
|
||||
iconURL: ReVancedLogoURL,
|
||||
})
|
||||
|
||||
|
||||
@@ -158,8 +158,10 @@ export const handleUserResponseCorrection = async (
|
||||
correctedById: user.id,
|
||||
})
|
||||
.where(eq(responses.replyId, response.replyId))
|
||||
|
||||
await reply.edit({
|
||||
embeds: [createMessageScanResponseEmbed(correctLabelResponse.response, 'nlp')],
|
||||
...correctLabelResponse.response,
|
||||
embeds: correctLabelResponse.response.embeds?.map(it => createMessageScanResponseEmbed(it, 'nlp')),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user