fix(matrix-bots): resolve TypeScript strict null check errors

- Fix parseInt undefined errors in configuration files
- Add fallbacks for Matrix client constructor parameters
- Fix possibly undefined data accesses with non-null assertions
- Update setCurrentConversation to accept null

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Till-JS 2026-01-30 17:32:09 +01:00
parent f07387d12c
commit 004fe85799
15 changed files with 44 additions and 44 deletions

View file

@ -60,8 +60,8 @@ export class MatrixService implements OnModuleInit {
return;
}
const storage = new SimpleFsStorageProvider(storagePath);
this.client = new MatrixClient(homeserverUrl, accessToken, storage);
const storage = new SimpleFsStorageProvider(storagePath || './data/bot-storage.json');
this.client = new MatrixClient(homeserverUrl || 'http://localhost:8008', accessToken, storage);
AutojoinRoomsMixin.setupOnClient(this.client);

View file

@ -1,5 +1,5 @@
export default () => ({
port: parseInt(process.env.PORT, 10) || 3326,
port: parseInt(process.env.PORT || '3326', 10),
matrix: {
homeserverUrl: process.env.MATRIX_HOMESERVER_URL || 'http://localhost:8008',
accessToken: process.env.MATRIX_ACCESS_TOKEN,