fix sendTo

This commit is contained in:
Evert Prants 2021-10-02 11:36:22 +03:00
parent 83abe6cc75
commit 4c70f47c98
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
3 changed files with 6 additions and 5 deletions

View File

@ -3,7 +3,7 @@
"name": "matrix",
"description": "Matrix.org Service for Squeebot 3",
"tags": ["service", "matrix"],
"version": "1.0.1",
"version": "1.0.2",
"dependencies": ["control?"],
"npmDependencies": ["matrix-bot-sdk@0.5.19"]
}

View File

@ -184,12 +184,13 @@ class MatrixProtocol extends Protocol {
return;
}
this.sendTo(msg.target.id, ...data);
this.sendTo(`${this.fullName}/${msg.target.id}`, ...data);
}
public async sendTo(target: string, ...data: any[]): Promise<boolean> {
let response = util.format(data[0], ...data.slice(1));
if (!response || !target) {
const rxSplit = target.split('/');
if (!response || !target || rxSplit.length !== 3) {
return false;
}
@ -202,7 +203,7 @@ class MatrixProtocol extends Protocol {
}
}
await this.client?.sendMessage(target, {
await this.client?.sendMessage(rxSplit[2], {
msgtype: 'm.text',
body: this.format.strip(response),
format: 'org.matrix.custom.html',

View File

@ -3,7 +3,7 @@
"plugins": [
{
"name": "matrix",
"version": "1.0.1"
"version": "1.0.2"
}
],
"typescript": true