@@ -99,18 +99,28 @@ def get_window(self):
9999 tab_urls = [
100100 [
101101 sg .Frame ("" , [
102- [sg .Text ("Links Ativados:" , size = (39 , 1 ), font = ("arial" ,11 ), justification = "center" ,
103- background_color = "green2" ),
104- sg .Text ("Links Desativados:" , size = (39 , 1 ), font = ("arial" ,11 ), justification = "center" ,
105- text_color = "white" , background_color = "red" )],
106- [sg .Listbox (values = self .config ["urls" ], size = (30 , 11 ),expand_x = True , key = "url_list" ,
107- horizontal_scroll = True , bind_return_key = True ),
108- sg .Listbox (values = self .config ["urls_disabled" ], size = (30 , 11 ), expand_x = True ,
109- horizontal_scroll = True , key = "url_list_disabled" , bind_return_key = True )
102+ [
103+ sg .Text ('Token de acesso:' ),
104+ sg .InputText (default_text = self .config ["token" ], key = "token" , size = (73 ,1 ), disabled = True ),
105+ sg .Button ("Colar Token" , key = "btn_paste_token" , enable_events = True )
106+ ],
107+ [
108+ sg .Text ("Links Ativados:" , size = (39 , 1 ), font = ("arial" , 11 ), justification = "center" ,
109+ background_color = "green2" ),
110+ sg .Text ("Links Desativados:" , size = (39 , 1 ), font = ("arial" , 11 ), justification = "center" ,
111+ text_color = "white" , background_color = "red" )
112+ ],
113+ [
114+ sg .Listbox (values = self .config ["urls" ], size = (30 , 12 ), expand_x = True , key = "url_list" ,
115+ horizontal_scroll = True , bind_return_key = True ),
116+ sg .Listbox (values = self .config ["urls_disabled" ], size = (30 , 12 ), expand_x = True ,
117+ horizontal_scroll = True , key = "url_list_disabled" , bind_return_key = True )
110118 ],
111- [sg .Button ("Adicionar" , key = "btn_add_url" , enable_events = True ),
112- sg .Button ("Editar" , key = "btn_edit_url" , enable_events = True ),
113- sg .Button ("Remover" , key = "btn_remove_url" , enable_events = True )]
119+ [
120+ sg .Button ("Adicionar" , key = "btn_add_url" , enable_events = True ),
121+ sg .Button ("Editar" , key = "btn_edit_url" , enable_events = True ),
122+ sg .Button ("Remover" , key = "btn_remove_url" , enable_events = True )
123+ ]
114124 ], expand_x = True )
115125 ]
116126 ]
@@ -120,8 +130,8 @@ def get_window(self):
120130 sg .TabGroup (
121131 [
122132 [
123- sg .Tab ('Config ' , tab_config , element_justification = 'center' ),
124- sg .Tab ('Socket URL \' s ' , tab_urls , key = "sockets_url" ),
133+ sg .Tab ('Main Settings ' , tab_config , element_justification = 'center' ),
134+ sg .Tab ('Socket Settings ' , tab_urls , key = "sockets_url" ),
125135 sg .Tab ('Assets' , tab_assets , element_justification = 'center' )
126136 ]
127137 ], key = "main_tab"
@@ -223,6 +233,19 @@ def window_loop(self):
223233 elif event == "clear_log" :
224234 self .window [MLINE_KEY ].update ("Log limpo com sucesso!\n " , text_color_for_value = 'green2' )
225235
236+ elif event == "btn_paste_token" :
237+
238+ token = self .window .TKroot .clipboard_get ()
239+
240+ if len (token ) != 50 :
241+ sg .popup_ok (f"O token colado não possui 50 caracteres:\n "
242+ f"{ ' ' .join (token .split ())[:100 ]} " )
243+ continue
244+
245+ self .config ["token" ] = token
246+ self .window ["token" ].update (value = token )
247+ self .update_data ()
248+
226249 elif event == "btn_add_url" :
227250
228251 while True :
@@ -299,6 +322,13 @@ def window_loop(self):
299322 sg .popup_ok (f"Você deve adicionar pelo menos um link WS antes de iniciar presence!" )
300323 self .window ["sockets_url" ].select ()
301324 continue
325+
326+ if not self .config ["token" ]:
327+ sg .popup_ok (f"Você deve incluir o token de acesso para iniciar presence!\n "
328+ f"Caso não tenha, use o comando /rich_presence no bot." )
329+ self .window ["sockets_url" ].select ()
330+ continue
331+
302332 self .client .gui = self
303333 try :
304334 self .client .get_app_instances ()
@@ -309,17 +339,16 @@ def window_loop(self):
309339 self .rpc_started = True
310340 self .update_buttons (
311341 enable = ["stop_presence" ],
312- disable = ["start_presence" , "load_all_instances" , "dummy_app_id" , "override_appid" ]
342+ disable = ["start_presence" , "load_all_instances" , "dummy_app_id" , "override_appid" , "btn_paste_token" ]
313343 )
314344
315345 elif event == "stop_presence" :
316346 self .client .close_app_instances ()
317347 self .client .exit ()
318- #time.sleep(2)
319348 self .update_log ("RPC Finalizado!\n -----" , tooltip = True )
320349 self .update_buttons (
321350 disable = ["stop_presence" ],
322- enable = ["start_presence" , "load_all_instances" , "dummy_app_id" , "override_appid" ]
351+ enable = ["start_presence" , "load_all_instances" , "dummy_app_id" , "override_appid" , "btn_paste_token" ]
323352 )
324353 self .rpc_started = False
325354
0 commit comments