mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-22 08:26:41 +02:00
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:
parent
9dfad0128a
commit
b50376dfdb
4 changed files with 94 additions and 49 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue