mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 15:44:02 +00:00
Merge remote-tracking branch 'origin/main' into codex/whe-31-adapters
# Conflicts: # tsconfig.json
This commit is contained in:
@@ -13,6 +13,7 @@ COPY packages/db/package.json packages/db/package.json
|
||||
COPY packages/domain/package.json packages/domain/package.json
|
||||
COPY packages/observability/package.json packages/observability/package.json
|
||||
COPY packages/ports/package.json packages/ports/package.json
|
||||
COPY scripts/package.json scripts/package.json
|
||||
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
|
||||
@@ -50,4 +50,13 @@ describe('extractPurchaseTopicCandidate', () => {
|
||||
|
||||
expect(record).toBeNull()
|
||||
})
|
||||
|
||||
test('skips slash commands in purchase topic', () => {
|
||||
const record = extractPurchaseTopicCandidate(
|
||||
candidate({ rawText: '/statement 2026-03' }),
|
||||
config
|
||||
)
|
||||
|
||||
expect(record).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -36,6 +36,10 @@ export function extractPurchaseTopicCandidate(
|
||||
value: PurchaseTopicCandidate,
|
||||
config: PurchaseTopicIngestionConfig
|
||||
): PurchaseTopicRecord | null {
|
||||
if (value.rawText.trim().startsWith('/')) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (value.chatId !== config.householdChatId) {
|
||||
return null
|
||||
}
|
||||
@@ -195,14 +199,16 @@ export function registerPurchaseTopicIngestion(
|
||||
llmFallback?: PurchaseParserLlmFallback
|
||||
} = {}
|
||||
): void {
|
||||
bot.on('message:text', async (ctx) => {
|
||||
bot.on('message:text', async (ctx, next) => {
|
||||
const candidate = toCandidateFromContext(ctx)
|
||||
if (!candidate) {
|
||||
await next()
|
||||
return
|
||||
}
|
||||
|
||||
const record = extractPurchaseTopicCandidate(candidate, config)
|
||||
if (!record) {
|
||||
await next()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ COPY packages/db/package.json packages/db/package.json
|
||||
COPY packages/domain/package.json packages/domain/package.json
|
||||
COPY packages/observability/package.json packages/observability/package.json
|
||||
COPY packages/ports/package.json packages/ports/package.json
|
||||
COPY scripts/package.json scripts/package.json
|
||||
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
|
||||
Reference in New Issue
Block a user