fix sendTo
This commit is contained in:
parent
83abe6cc75
commit
4c70f47c98
@ -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"]
|
||||
}
|
||||
|
@ -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',
|
||||
|
@ -3,7 +3,7 @@
|
||||
"plugins": [
|
||||
{
|
||||
"name": "matrix",
|
||||
"version": "1.0.1"
|
||||
"version": "1.0.2"
|
||||
}
|
||||
],
|
||||
"typescript": true
|
||||
|
Loading…
Reference in New Issue
Block a user