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

Commit 641662a

Browse files
committed
Update WebSocket Client.py
1 parent d909178 commit 641662a

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

examples/sync/WebSocket Client.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,23 @@
33

44
class Client(WSSClient):
55
def on_friend_location(self, friend, world, location, instance):
6-
print("Friend changed world.")
6+
print("{} is now in {}.".format(friend.displayName, world.name))
77

88
def on_friend_offline(self, friend):
9-
print("Friend went offline.")
9+
print("{} went offline.".format(friend.displayName))
1010

1111
def on_friend_active(self, friend):
12-
print("Friend is now active.")
12+
print("{} is now {}.".format(friend.displayName, friend.state))
13+
14+
def on_friend_online(self, friend):
15+
print("{} is now online.".format(friend.displayName))
1316

1417
def on_notification(self, notification):
15-
print("Got a notification.")
18+
print("Got a {} notification from {}.".format(notification.type, notification.senderUsername))
1619

1720
def wait_loop(self):
21+
self.login2fa(input("Username: "), input("Password: "), input("2FA Code: "), True)
22+
1823
try:
1924
while True:
2025
time.sleep(1)
@@ -23,8 +28,6 @@ def wait_loop(self):
2328

2429
def __init__(self):
2530
super().__init__()
26-
27-
self.login2fa(input("Username: "), input("Password: "), input("2FA Code: "), True)
2831
self.wait_loop()
2932

3033
c = Client()

0 commit comments

Comments
 (0)