Skip to content
This repository was archived by the owner on Dec 20, 2021. It is now read-only.

Commit d909178

Browse files
committed
friend-online event
1 parent 8d3fd94 commit d909178

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

vrcpy/wss.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def _ws_message(self, ws, message):
1818

1919
switch = {
2020
"friend-location": self._ws_friend_location,
21+
"friend-online": self._ws_friend_online,
2122
"friend-active": self._ws_friend_active,
2223
"friend-offline": self._ws_friend_offline,
2324
"notification": self._ws_notification
@@ -47,7 +48,7 @@ def _open_ws(self):
4748
else:
4849
auth = self.api.session.cookies.get("auth")
4950

50-
websocket.enableTrace(True)
51+
#websocket.enableTrace(True)
5152
self.ws = websocket.WebSocketApp(
5253
"wss://pipeline.vrchat.cloud/?authToken="+auth,
5354
on_message=self._ws_message,
@@ -62,6 +63,9 @@ def _open_ws(self):
6263
class WSSClient(Client, _WSSClient):
6364
# User WS overwrites
6465

66+
def on_friend_online(self, friend):
67+
pass
68+
6569
def on_friend_active(self, friend):
6670
pass
6771

@@ -76,6 +80,9 @@ def on_notification(self, notification):
7680

7781
# WS handles
7882

83+
def _ws_friend_online(self, content):
84+
self.on_friend_online(objects.User(self, content["user"]))
85+
7986
def _ws_friend_active(self, content):
8087
self.on_friend_active(objects.User(self, content["user"]))
8188

@@ -120,6 +127,9 @@ def __init__(self, verify=True):
120127
class AWSSClient(AClient, _WSSClient):
121128
# User WS overwrites
122129

130+
async def on_friend_online(self, friend):
131+
pass
132+
123133
async def on_friend_active(self, friend):
124134
pass
125135

@@ -134,12 +144,13 @@ async def on_notification(self, notification):
134144

135145
# WS handles
136146

147+
async def _ws_friend_online(self, content):
148+
await self.on_friend_online(aobjects.User(self, content["user"]))
149+
137150
async def _ws_friend_active(self, content):
138151
await self.on_friend_active(aobjects.User(self, content["user"]))
139152

140153
async def _ws_friend_location(self, content):
141-
print(content["world"].keys())
142-
143154
world = aobjects.World(self, content["world"])
144155
user = aobjects.User(self, content["user"])
145156
location = aobjects.Location(self, content["location"])

0 commit comments

Comments
 (0)