fix(matrix-bots): update to matrix-bot-sdk v0.7 API

- Import LogLevel separately instead of LogService.LogLevel
- Change sendTyping to setTyping
- Use any type for event handler to avoid generic type issues
- Fix Buffer to Uint8Array conversion for OpenAI File API

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Till-JS 2026-01-28 12:40:28 +01:00
parent 9dfad0128a
commit b50376dfdb
4 changed files with 94 additions and 49 deletions

View file

@ -6,8 +6,7 @@ import {
AutojoinRoomsMixin,
RichConsoleLogger,
LogService,
MessageEvent,
RoomEvent,
LogLevel,
} from 'matrix-bot-sdk';
import { AnalyticsService } from '../analytics/analytics.service';
import { UsersService } from '../users/users.service';
@ -38,7 +37,7 @@ export class MatrixService implements OnModuleInit, OnModuleDestroy {
}
LogService.setLogger(new RichConsoleLogger());
LogService.setLevel(LogService.LogLevel.INFO);
LogService.setLevel(LogLevel.INFO);
const storage = new SimpleFsStorageProvider(storagePath || './data/bot-storage.json');
this.client = new MatrixClient(homeserverUrl!, accessToken, storage);
@ -61,10 +60,10 @@ export class MatrixService implements OnModuleInit, OnModuleDestroy {
}
}
private async handleRoomMessage(roomId: string, event: RoomEvent<MessageEvent>) {
private async handleRoomMessage(roomId: string, event: any) {
if (event.sender === this.botUserId) return;
const content = event.content;
const content = event.content as { msgtype?: string; body?: string };
if (content.msgtype !== 'm.text') return;
const body = content.body;