Skip to content

Commit

Permalink
Added "exception" op support.
Browse files Browse the repository at this point in the history
Bump to v2.3
  • Loading branch information
zRitsu committed Mar 21, 2023
1 parent cadecbf commit 6a782e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
class RPCGui:

def __init__(self, client: RpcClient):
self.appname = "Discord RPC (Music Bot)"
self.client = client
self.appname = f"Discord RPC (Music Bot) v{self.client.version}"
self.config = self.client.config
self.ready = False

Expand Down Expand Up @@ -235,7 +235,7 @@ def window_loop(self):

elif event == "btn_paste_token":

token = self.window.TKroot.clipboard_get()
token = self.window.TKroot.clipboard_get().replace("\n","").replace(" ", "")

if len(token) != 50:
sg.popup_ok(f"O token colado não possui 50 caracteres:\n"
Expand Down
10 changes: 9 additions & 1 deletion rpc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def fix_characters(text: str, limit=30):
class RpcClient:

def __init__(self):
self.version = 2.3
self.last_data = {}
self.tasks = []
self.main_task = None
Expand Down Expand Up @@ -575,7 +576,7 @@ async def handle_socket(self, uri):
"op": "rpc_update",
"user_ids": list(user_clients),
"token": self.config["token"].replace(" ", ""),
"version": 2.1
"version": self.version
}
)
)
Expand Down Expand Up @@ -622,6 +623,13 @@ async def handle_socket(self, uri):
except KeyError:
continue

if data['op'] == "exception":
self.gui.update_log(f"op: {data['op']} | {user} {user_ws} | "
f"bot: {(bot_name + ' ') if bot_name else ''}[{bot_id}] | "
f"\nerror: {data.get('message')}",
log_type="error")
continue

self.gui.update_log(f"op: {data['op']} | {user} {user_ws} | "
f"bot: {(bot_name + ' ') if bot_name else ''}[{bot_id}]",
log_type="info")
Expand Down

0 comments on commit 6a782e6

Please sign in to comment.