mirror of
https://github.com/icewind1991/mx-puppet-steam.git
synced 2026-06-03 09:34:13 +02:00
add listusers
This commit is contained in:
parent
cc607167ec
commit
cdfaf57cb9
3 changed files with 13 additions and 0 deletions
|
|
@ -91,6 +91,7 @@ async function run() {
|
|||
puppet.on("video", steam.handleMatrixVideo.bind(steam));
|
||||
puppet.setCreateUserHook(steam.createUser.bind(steam));
|
||||
// puppet.setGetUserIdsInRoomHook(steam.getUserIdsInRoom.bind(steam));
|
||||
puppet.setListUsersHook(steam.listUsers.bind(steam));
|
||||
puppet.setGetDescHook(async (puppetId: number, data: any): Promise<string> => {
|
||||
let s = "Steam";
|
||||
if (data.screenName) {
|
||||
|
|
|
|||
10
src/steam.ts
10
src/steam.ts
|
|
@ -12,6 +12,7 @@ import * as SteamID from "steamid";
|
|||
import {EPersonaState} from "./enum";
|
||||
import {MatrixPresence} from "mx-puppet-bridge/lib/src/presencehandler";
|
||||
import {AppInfo, IIncomingFriendMessage, IPersona} from "./interfaces";
|
||||
import {IRetList} from "mx-puppet-bridge/src/interfaces";
|
||||
|
||||
const log = new Log("MatrixPuppet:Steam");
|
||||
|
||||
|
|
@ -288,6 +289,15 @@ export class Steam {
|
|||
};
|
||||
}
|
||||
|
||||
public async listUsers(puppetId: number): Promise<IRetList[]> {
|
||||
let friends = this.puppets[puppetId].client.users as {[steamId: string]: IPersona};
|
||||
|
||||
return Object.keys(friends).map((steamId) => ({
|
||||
id: steamId,
|
||||
name: friends[steamId].player_name
|
||||
}));
|
||||
}
|
||||
|
||||
// public async getUserIdsInRoom(room: IRemoteRoom): Promise<Set<string> | null> {
|
||||
// const p = this.puppets[room.puppetId];
|
||||
// const client: TalkClient = p.client;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue