Skip to content

Conversation

@konard
Copy link
Owner

@konard konard commented Oct 17, 2025

🤖 AI-Powered Solution

This pull request implements support for detecting and responding to messages that combine both a greeting and an acquaintance question in a single message.

📋 Issue Reference

Fixes #15

🎯 Problem

Previously, the bot had separate triggers for:

  • Greeting messages (e.g., "Привет")
  • Acquaintance questions (e.g., "Мы знакомы?")

However, when users sent combined messages like "Привет! Мы знакомы?", neither trigger would fire because each trigger expected the ENTIRE message to match only its pattern (using ^ and $ anchors).

✅ Solution

Created a new GreetingAndAcquaintanceTrigger that:

  1. Uses partial regex matching to detect both greeting and acquaintance patterns within the same message
  2. Supports all existing greeting patterns (text, emojis, stickers) + acquaintance questions
  3. Responds with contextually appropriate combined responses
  4. Works regardless of the order (greeting first or acquaintance question first)

📝 Implementation Details

New Files:

  • triggers/greeting-and-acquaintance.js - Main trigger implementation
  • __tests__/triggers/greeting-and-acquaintance.js - Comprehensive test suite (18 tests, all passing)

Modified Files:

  • triggers/acquaintance.js - Exported acquaintedRegex for potential reuse

Key Features:

  • Detects combinations like:
    • "Привет! Мы знакомы?"
    • "Здравствуйте! Мы знакомы с тобой?"
    • "🖐 Мы знакомы?"
    • "Знакомы мы? Привет" (reverse order)
    • Greeting sticker + "Мы знакомы?" text
  • 12 different response variations to keep conversations natural
  • Once-per-day trigger limit (consistent with other triggers)
  • Full test coverage with various message combinations

🧪 Test Results

PASS __tests__/triggers/greeting-and-acquaintance.js
  greeting and acquaintance trigger
    ✓ 12 different message combinations
    ✓ 4 negative tests (messages that should NOT match)
    ✓ Sticker + text combination
    ✓ Function correctness test

Tests:       18 passed

This PR was created automatically by the AI issue solver

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: undefined
@konard konard self-assigned this Oct 17, 2025
Implements detection and response for messages that contain both a
greeting and an acquaintance question (e.g., "Привет! Мы знакомы?").

- Created GreetingAndAcquaintanceTrigger that uses partial regex matching
  to detect both greeting and acquaintance patterns within a single message
- Uses greeting emojis/words and stickers combined with "знакомы?" patterns
- Responds with contextually appropriate combined responses
- Added comprehensive tests covering various message combinations
- Exported acquaintedRegex from acquaintance trigger for reuse

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] React to combinations of greeting and acquaintance in single message React to combinations of greeting and acquaintance in single message Oct 17, 2025
@konard konard marked this pull request as ready for review October 17, 2025 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

React to combinations of greeting and acquaintance in single message

1 participant