fix sendTo
This commit is contained in:
parent
83abe6cc75
commit
4c70f47c98
@ -3,7 +3,7 @@
|
|||||||
"name": "matrix",
|
"name": "matrix",
|
||||||
"description": "Matrix.org Service for Squeebot 3",
|
"description": "Matrix.org Service for Squeebot 3",
|
||||||
"tags": ["service", "matrix"],
|
"tags": ["service", "matrix"],
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"dependencies": ["control?"],
|
"dependencies": ["control?"],
|
||||||
"npmDependencies": ["matrix-bot-sdk@0.5.19"]
|
"npmDependencies": ["matrix-bot-sdk@0.5.19"]
|
||||||
}
|
}
|
||||||
|
@ -184,12 +184,13 @@ class MatrixProtocol extends Protocol {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sendTo(msg.target.id, ...data);
|
this.sendTo(`${this.fullName}/${msg.target.id}`, ...data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async sendTo(target: string, ...data: any[]): Promise<boolean> {
|
public async sendTo(target: string, ...data: any[]): Promise<boolean> {
|
||||||
let response = util.format(data[0], ...data.slice(1));
|
let response = util.format(data[0], ...data.slice(1));
|
||||||
if (!response || !target) {
|
const rxSplit = target.split('/');
|
||||||
|
if (!response || !target || rxSplit.length !== 3) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +203,7 @@ class MatrixProtocol extends Protocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.client?.sendMessage(target, {
|
await this.client?.sendMessage(rxSplit[2], {
|
||||||
msgtype: 'm.text',
|
msgtype: 'm.text',
|
||||||
body: this.format.strip(response),
|
body: this.format.strip(response),
|
||||||
format: 'org.matrix.custom.html',
|
format: 'org.matrix.custom.html',
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"plugins": [
|
"plugins": [
|
||||||
{
|
{
|
||||||
"name": "matrix",
|
"name": "matrix",
|
||||||
"version": "1.0.1"
|
"version": "1.0.2"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"typescript": true
|
"typescript": true
|
||||||
|
Loading…
Reference in New Issue
Block a user