File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515class RPCGui :
1616
1717 def __init__ (self , client : RpcClient ):
18- self .appname = "Discord RPC (Music Bot)"
1918 self .client = client
19+ self .appname = f"Discord RPC (Music Bot) v{ self .client .version } "
2020 self .config = self .client .config
2121 self .ready = False
2222
@@ -235,7 +235,7 @@ def window_loop(self):
235235
236236 elif event == "btn_paste_token" :
237237
238- token = self .window .TKroot .clipboard_get ()
238+ token = self .window .TKroot .clipboard_get (). replace ( " \n " , "" ). replace ( " " , "" )
239239
240240 if len (token ) != 50 :
241241 sg .popup_ok (f"O token colado não possui 50 caracteres:\n "
Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ def fix_characters(text: str, limit=30):
119119class RpcClient :
120120
121121 def __init__ (self ):
122+ self .version = 2.3
122123 self .last_data = {}
123124 self .tasks = []
124125 self .main_task = None
@@ -575,7 +576,7 @@ async def handle_socket(self, uri):
575576 "op" : "rpc_update" ,
576577 "user_ids" : list (user_clients ),
577578 "token" : self .config ["token" ].replace (" " , "" ),
578- "version" : 2.1
579+ "version" : self . version
579580 }
580581 )
581582 )
@@ -622,6 +623,13 @@ async def handle_socket(self, uri):
622623 except KeyError :
623624 continue
624625
626+ if data ['op' ] == "exception" :
627+ self .gui .update_log (f"op: { data ['op' ]} | { user } { user_ws } | "
628+ f"bot: { (bot_name + ' ' ) if bot_name else '' } [{ bot_id } ] | "
629+ f"\n error: { data .get ('message' )} " ,
630+ log_type = "error" )
631+ continue
632+
625633 self .gui .update_log (f"op: { data ['op' ]} | { user } { user_ws } | "
626634 f"bot: { (bot_name + ' ' ) if bot_name else '' } [{ bot_id } ]" ,
627635 log_type = "info" )
You can’t perform that action at this time.
0 commit comments