mirror of
https://github.com/icewind1991/mx-puppet-steam.git
synced 2026-06-03 09:34:13 +02:00
implement steam->matrix image sending
This commit is contained in:
parent
3aa54d0cd2
commit
d4893cf67b
2 changed files with 21 additions and 3 deletions
|
|
@ -11,6 +11,13 @@ export interface IIncomingFriendMessage {
|
|||
ordinal: number,
|
||||
local_echo: boolean,
|
||||
low_priority: boolean
|
||||
message_bbcode_parsed: BBCodeNode[]
|
||||
}
|
||||
|
||||
export interface BBCodeNode {
|
||||
tag: string
|
||||
attrs: { [attr: string]: string },
|
||||
content: BBCodeNode[]
|
||||
}
|
||||
|
||||
export interface IIncomingChatMessage {
|
||||
|
|
|
|||
17
src/steam.ts
17
src/steam.ts
|
|
@ -205,9 +205,20 @@ export class Steam {
|
|||
const p = this.puppets[puppetId];
|
||||
log.verbose("Got message from steam to pass on");
|
||||
|
||||
await this.bridge.sendMessage(await this.getSendParams(puppetId, message, fromSteamId), {
|
||||
body: message.message,
|
||||
});
|
||||
let sendParams = await this.getSendParams(puppetId, message, fromSteamId);
|
||||
|
||||
// message is only an embedded image
|
||||
if (
|
||||
message.message_bbcode_parsed.length === 1
|
||||
&& message.message_bbcode_parsed[0].tag === 'img'
|
||||
&& message.message_no_bbcode === message.message_bbcode_parsed[0].attrs['src']
|
||||
) {
|
||||
await this.bridge.sendImage(sendParams, message.message_bbcode_parsed[0].attrs['src']);
|
||||
} else {
|
||||
await this.bridge.sendMessage(sendParams, {
|
||||
body: message.message_no_bbcode,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public async handleFriendTyping(puppetId: number, message: IIncomingFriendMessage) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue