mirror of
https://github.com/icewind1991/mx-puppet-steam.git
synced 2026-06-03 17:44:09 +02:00
keeping track of typing is done by the bridge
This commit is contained in:
parent
bfbd3b7977
commit
c6be6d0a3f
1 changed files with 2 additions and 14 deletions
16
src/steam.ts
16
src/steam.ts
|
|
@ -22,7 +22,6 @@ interface ISteamPuppet {
|
||||||
client: SteamUser;
|
client: SteamUser;
|
||||||
data: any;
|
data: any;
|
||||||
sentEventIds: string[];
|
sentEventIds: string[];
|
||||||
typingUsers: { [key: string]: any };
|
|
||||||
knownPersonas: Map<string, IPersona>,
|
knownPersonas: Map<string, IPersona>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -152,13 +151,6 @@ export class Steam {
|
||||||
public async handleFriendMessage(puppetId: number, message: IIncomingFriendMessage, fromSteamId?: SteamID) {
|
public async handleFriendMessage(puppetId: number, message: IIncomingFriendMessage, fromSteamId?: SteamID) {
|
||||||
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");
|
||||||
const typingKey = message.steamid_friend.toString();
|
|
||||||
|
|
||||||
if (p.typingUsers[typingKey]) {
|
|
||||||
// user is typing, stop that
|
|
||||||
await this.bridge.setUserTyping(p.typingUsers[typingKey], false);
|
|
||||||
delete p.typingUsers[typingKey];
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.bridge.sendMessage(await this.getSendParams(puppetId, message, fromSteamId), {
|
await this.bridge.sendMessage(await this.getSendParams(puppetId, message, fromSteamId), {
|
||||||
body: message.message,
|
body: message.message,
|
||||||
|
|
@ -166,10 +158,7 @@ export class Steam {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async handleFriendTyping(puppetId: number, message: IIncomingFriendMessage) {
|
public async handleFriendTyping(puppetId: number, message: IIncomingFriendMessage) {
|
||||||
const p = this.puppets[puppetId];
|
await this.bridge.setUserTyping({
|
||||||
const typingKey = message.steamid_friend.toString();
|
|
||||||
|
|
||||||
p.typingUsers[typingKey] = {
|
|
||||||
room: {
|
room: {
|
||||||
puppetId,
|
puppetId,
|
||||||
roomId: message.steamid_friend.toString(),
|
roomId: message.steamid_friend.toString(),
|
||||||
|
|
@ -178,8 +167,7 @@ export class Steam {
|
||||||
puppetId,
|
puppetId,
|
||||||
userId: message.steamid_friend.toString(),
|
userId: message.steamid_friend.toString(),
|
||||||
},
|
},
|
||||||
};
|
}, true);
|
||||||
await this.bridge.setUserTyping(p.typingUsers[typingKey], true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue