mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-23 04:26:42 +02:00
✨ feat: add KeywordCommandDetector to all 19 Matrix bots
All bots now support natural language commands via KeywordCommandDetector: - matrix-chat-bot (gespraeche, modelle, verlauf, etc.) - matrix-mana-bot (todo, timer, kalender, summary, etc.) - matrix-manadeck-bot (decks, karten, lernen, mana, etc.) - matrix-planta-bot (pflanzen, giessen, faellig, etc.) - matrix-presi-bot (presis, folien, themes, teilen, etc.) - matrix-project-doc-bot (projekte, generate, export, etc.) - matrix-questions-bot (fragen, recherche, antwort, etc.) - matrix-skilltree-bot (skills, xp, stats, aktivitaeten, etc.) - matrix-stats-bot (stats, heute, woche, realtime, etc.) - matrix-storage-bot (dateien, ordner, teilen, suche, etc.) - matrix-tts-bot (voice, voices, speed, etc.) All bots include COMMON_KEYWORDS (hilfe, help, status). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
c28410b736
commit
a23430f210
14 changed files with 261 additions and 36 deletions
|
|
@ -5,6 +5,8 @@ import {
|
|||
MatrixBotConfig,
|
||||
MatrixRoomEvent,
|
||||
UserListMapper,
|
||||
KeywordCommandDetector,
|
||||
COMMON_KEYWORDS,
|
||||
} from '@manacore/matrix-bot-common';
|
||||
import { SkilltreeService, Skill, SkillBranch } from '../skilltree/skilltree.service';
|
||||
import { SessionService } from '@manacore/bot-services';
|
||||
|
|
@ -15,6 +17,15 @@ export class MatrixService extends BaseMatrixService {
|
|||
// User list mapper for number-based reference
|
||||
private skillsMapper = new UserListMapper<Skill>();
|
||||
|
||||
private readonly keywordDetector = new KeywordCommandDetector([
|
||||
...COMMON_KEYWORDS,
|
||||
{ keywords: ['skills', 'faehigkeiten', 'meine skills', 'liste'], command: 'skills' },
|
||||
{ keywords: ['xp', 'punkte', 'erfahrung', 'erfahrungspunkte'], command: 'xp' },
|
||||
{ keywords: ['stats', 'statistik', 'statistiken', 'fortschritt'], command: 'stats' },
|
||||
{ keywords: ['aktivitaeten', 'activities', 'verlauf', 'historie'], command: 'aktivitaeten' },
|
||||
{ keywords: ['neu', 'new', 'neuer skill', 'skill erstellen'], command: 'neu' },
|
||||
]);
|
||||
|
||||
// Branch name mappings (German/English)
|
||||
private readonly branchMappings: Record<string, SkillBranch> = {
|
||||
intellect: 'intellect',
|
||||
|
|
@ -64,6 +75,12 @@ export class MatrixService extends BaseMatrixService {
|
|||
event: MatrixRoomEvent,
|
||||
body: string
|
||||
): Promise<void> {
|
||||
// Check for keyword commands first
|
||||
const keywordCommand = this.keywordDetector.detect(body);
|
||||
if (keywordCommand) {
|
||||
body = `!${keywordCommand}`;
|
||||
}
|
||||
|
||||
if (!body.startsWith('!')) return;
|
||||
|
||||
const sender = event.sender;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue