mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
feat(bots/discord): add additional options for respondToReply
This commit is contained in:
@@ -72,7 +72,7 @@ export type ConfigMessageScanResponse = {
|
|||||||
}
|
}
|
||||||
filterOverride?: NonNullable<Config['messageScan']>['filter']
|
filterOverride?: NonNullable<Config['messageScan']>['filter']
|
||||||
response: ConfigMessageScanResponseMessage
|
response: ConfigMessageScanResponseMessage
|
||||||
respondToReply?: boolean
|
respondToReply?: boolean | 'only_regex' | 'only_labeled'
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ConfigMessageScanResponseLabelConfig = {
|
export type ConfigMessageScanResponseLabelConfig = {
|
||||||
|
|||||||
@@ -33,7 +33,15 @@ withContext(on, 'messageCreate', async (context, msg) => {
|
|||||||
if (response) {
|
if (response) {
|
||||||
logger.debug('Response found')
|
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({
|
const reply = await toReply.reply({
|
||||||
...response,
|
...response,
|
||||||
embeds: response.embeds?.map(createMessageScanResponseEmbed),
|
embeds: response.embeds?.map(createMessageScanResponseEmbed),
|
||||||
|
|||||||
Reference in New Issue
Block a user