Skip to content

Commit 399c201

Browse files
committed
feat(bots/discord): add additional options for respondToReply
1 parent 0a5a9c3 commit 399c201

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

bots/discord/config.schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export type ConfigMessageScanResponse = {
7272
}
7373
filterOverride?: NonNullable<Config['messageScan']>['filter']
7474
response: ConfigMessageScanResponseMessage
75-
respondToReply?: boolean
75+
respondToReply?: boolean | 'only_regex' | 'only_labeled'
7676
}
7777

7878
export type ConfigMessageScanResponseLabelConfig = {

bots/discord/src/events/discord/messageCreate/messageScan.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@ withContext(on, 'messageCreate', async (context, msg) => {
3333
if (response) {
3434
logger.debug('Response found')
3535

36-
const toReply = respondToReply ? (msg.reference?.messageId ? await msg.fetchReference() : msg) : msg
36+
const toReply = (
37+
respondToReply === true
38+
? true
39+
: (respondToReply === 'only_labeled' && label !== undefined) ||
40+
(respondToReply === 'only_regex' && label === undefined)
41+
)
42+
? await msg.fetchReference()
43+
: msg
44+
3745
const reply = await toReply.reply({
3846
...response,
3947
embeds: response.embeds?.map(createMessageScanResponseEmbed),

0 commit comments

Comments
 (0)