feat(bots/discord): add additional options for respondToReply

This commit is contained in:
PalmDevs
2025-09-13 20:42:28 +07:00
parent 0a5a9c3e27
commit 399c201f8c
2 changed files with 10 additions and 2 deletions

View File

@@ -72,7 +72,7 @@ export type ConfigMessageScanResponse = {
}
filterOverride?: NonNullable<Config['messageScan']>['filter']
response: ConfigMessageScanResponseMessage
respondToReply?: boolean
respondToReply?: boolean | 'only_regex' | 'only_labeled'
}
export type ConfigMessageScanResponseLabelConfig = {

View File

@@ -33,7 +33,15 @@ withContext(on, 'messageCreate', async (context, msg) => {
if (response) {
logger.debug('Response found')
const toReply = respondToReply ? (msg.reference?.messageId ? await msg.fetchReference() : msg) : msg
const toReply = (
respondToReply === true
? true
: (respondToReply === 'only_labeled' && label !== undefined) ||
(respondToReply === 'only_regex' && label === undefined)
)
? await msg.fetchReference()
: msg
const reply = await toReply.reply({
...response,
embeds: response.embeds?.map(createMessageScanResponseEmbed),