mirror of
https://github.com/icewind1991/mx-puppet-steam.git
synced 2026-06-03 17:44:09 +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,
|
ordinal: number,
|
||||||
local_echo: boolean,
|
local_echo: boolean,
|
||||||
low_priority: boolean
|
low_priority: boolean
|
||||||
|
message_bbcode_parsed: BBCodeNode[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BBCodeNode {
|
||||||
|
tag: string
|
||||||
|
attrs: { [attr: string]: string },
|
||||||
|
content: BBCodeNode[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IIncomingChatMessage {
|
export interface IIncomingChatMessage {
|
||||||
|
|
|
||||||
15
src/steam.ts
15
src/steam.ts
|
|
@ -205,10 +205,21 @@ export class Steam {
|
||||||
const p = this.puppets[puppetId];
|
const p = this.puppets[puppetId];
|
||||||
log.verbose("Got message from steam to pass on");
|
log.verbose("Got message from steam to pass on");
|
||||||
|
|
||||||
await this.bridge.sendMessage(await this.getSendParams(puppetId, message, fromSteamId), {
|
let sendParams = await this.getSendParams(puppetId, message, fromSteamId);
|
||||||
body: message.message,
|
|
||||||
|
// 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) {
|
public async handleFriendTyping(puppetId: number, message: IIncomingFriendMessage) {
|
||||||
await this.bridge.setUserTyping({
|
await this.bridge.setUserTyping({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue