mirror of
https://github.com/icewind1991/mx-puppet-steam.git
synced 2026-06-03 17:44:09 +02:00
add listusers
This commit is contained in:
parent
cc607167ec
commit
cdfaf57cb9
3 changed files with 13 additions and 0 deletions
|
|
@ -10,6 +10,8 @@ Matrix <-> Steam puppeting bridge based on [mx-puppet-bridge](https://github.com
|
||||||
- [x] steam -> matrix typing notifications
|
- [x] steam -> matrix typing notifications
|
||||||
- [x] online/offline status
|
- [x] online/offline status
|
||||||
- [x] retrieve nickname and avatar from steam
|
- [x] retrieve nickname and avatar from steam
|
||||||
|
- [x] listing of steam users
|
||||||
|
- [ ] listing of steam group chats
|
||||||
|
|
||||||
## Linking
|
## Linking
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ async function run() {
|
||||||
puppet.on("video", steam.handleMatrixVideo.bind(steam));
|
puppet.on("video", steam.handleMatrixVideo.bind(steam));
|
||||||
puppet.setCreateUserHook(steam.createUser.bind(steam));
|
puppet.setCreateUserHook(steam.createUser.bind(steam));
|
||||||
// puppet.setGetUserIdsInRoomHook(steam.getUserIdsInRoom.bind(steam));
|
// puppet.setGetUserIdsInRoomHook(steam.getUserIdsInRoom.bind(steam));
|
||||||
|
puppet.setListUsersHook(steam.listUsers.bind(steam));
|
||||||
puppet.setGetDescHook(async (puppetId: number, data: any): Promise<string> => {
|
puppet.setGetDescHook(async (puppetId: number, data: any): Promise<string> => {
|
||||||
let s = "Steam";
|
let s = "Steam";
|
||||||
if (data.screenName) {
|
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 {EPersonaState} from "./enum";
|
||||||
import {MatrixPresence} from "mx-puppet-bridge/lib/src/presencehandler";
|
import {MatrixPresence} from "mx-puppet-bridge/lib/src/presencehandler";
|
||||||
import {AppInfo, IIncomingFriendMessage, IPersona} from "./interfaces";
|
import {AppInfo, IIncomingFriendMessage, IPersona} from "./interfaces";
|
||||||
|
import {IRetList} from "mx-puppet-bridge/src/interfaces";
|
||||||
|
|
||||||
const log = new Log("MatrixPuppet:Steam");
|
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> {
|
// public async getUserIdsInRoom(room: IRemoteRoom): Promise<Set<string> | null> {
|
||||||
// const p = this.puppets[room.puppetId];
|
// const p = this.puppets[room.puppetId];
|
||||||
// const client: TalkClient = p.client;
|
// const client: TalkClient = p.client;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue