mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 17:54:02 +00:00
fix(bot): silence topic processor failure messages unless explicitly mentioned
Previously, the bot would reply with a 'Zzz...' message to every message in a topic if the topic processor failed or was missing. This change ensures the bot remains silent unless it is explicitly mentioned by the user.
This commit is contained in:
@@ -635,8 +635,9 @@ export function registerConfiguredPaymentTopicIngestion(
|
||||
engagementAssessment: conversationContext.engagement
|
||||
})
|
||||
|
||||
// Handle processor failure
|
||||
// Handle processor failure - only if explicitly mentioned
|
||||
if (!processorResult) {
|
||||
if (conversationContext.explicitMention) {
|
||||
const { botSleepsMessage } = await import('./topic-processor')
|
||||
await replyToPaymentMessage(
|
||||
ctx,
|
||||
@@ -647,6 +648,9 @@ export function registerConfiguredPaymentTopicIngestion(
|
||||
record
|
||||
}
|
||||
)
|
||||
} else {
|
||||
await next()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -856,12 +860,21 @@ export function registerConfiguredPaymentTopicIngestion(
|
||||
}
|
||||
}
|
||||
|
||||
// No topic processor available - bot sleeps
|
||||
// No topic processor available
|
||||
if (stripExplicitBotMention(ctx) !== null) {
|
||||
const { botSleepsMessage } = await import('./topic-processor')
|
||||
await replyToPaymentMessage(ctx, botSleepsMessage(locale === 'ru' ? 'ru' : 'en'), undefined, {
|
||||
await replyToPaymentMessage(
|
||||
ctx,
|
||||
botSleepsMessage(locale === 'ru' ? 'ru' : 'en'),
|
||||
undefined,
|
||||
{
|
||||
repository: options.historyRepository,
|
||||
record
|
||||
})
|
||||
}
|
||||
)
|
||||
} else {
|
||||
await next()
|
||||
}
|
||||
} catch (error) {
|
||||
options.logger?.error(
|
||||
{
|
||||
|
||||
@@ -2476,8 +2476,9 @@ export function registerConfiguredPurchaseTopicIngestion(
|
||||
engagementAssessment: conversationContext.engagement
|
||||
})
|
||||
|
||||
// Handle processor failure - fun "bot sleeps" message
|
||||
// Handle processor failure - fun "bot sleeps" message only if explicitly mentioned
|
||||
if (!processorResult) {
|
||||
if (conversationContext.explicitMention) {
|
||||
const { botSleepsMessage } = await import('./topic-processor')
|
||||
await replyToPurchaseMessage(
|
||||
ctx,
|
||||
@@ -2488,6 +2489,9 @@ export function registerConfiguredPurchaseTopicIngestion(
|
||||
record
|
||||
}
|
||||
)
|
||||
} else {
|
||||
await next()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -2586,7 +2590,8 @@ export function registerConfiguredPurchaseTopicIngestion(
|
||||
}
|
||||
}
|
||||
|
||||
// No topic processor available - bot sleeps
|
||||
// No topic processor available
|
||||
if (conversationContext.explicitMention) {
|
||||
const { botSleepsMessage } = await import('./topic-processor')
|
||||
await replyToPurchaseMessage(
|
||||
ctx,
|
||||
@@ -2597,6 +2602,9 @@ export function registerConfiguredPurchaseTopicIngestion(
|
||||
record
|
||||
}
|
||||
)
|
||||
} else {
|
||||
await next()
|
||||
}
|
||||
} catch (error) {
|
||||
options.logger?.error(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user