@@ -28,22 +28,17 @@ pub struct Payload {
2828}
2929
3030impl Discord {
31- pub fn new ( discord_client_id : String ) -> Result < Discord , Box < dyn std:: error:: Error > > {
32- let client = DiscordIpcClient :: new ( & discord_client_id) . map_err ( |e| {
33- tracing:: error!( "Couldn't create Discord client: {e}" ) ;
34- e
35- } ) ?;
36- Ok ( Discord {
37- client,
31+ pub fn new ( discord_client_id : String ) -> Discord {
32+ Discord {
33+ client : DiscordIpcClient :: new ( & discord_client_id) ,
3834 current_app_id : discord_client_id,
39- } )
35+ }
4036 }
4137
4238 /// Switch to a different Discord application ID if needed.
43- /// Returns true if a switch occurred.
44- fn switch_app_id ( & mut self , new_app_id : & str ) -> bool {
39+ fn switch_app_id ( & mut self , new_app_id : & str ) {
4540 if self . current_app_id == new_app_id {
46- return false ;
41+ return ;
4742 }
4843
4944 tracing:: info!(
@@ -56,18 +51,9 @@ impl Discord {
5651 let _ = self . client . close ( ) ;
5752
5853 // Create new client with new app ID
59- match DiscordIpcClient :: new ( new_app_id) {
60- Ok ( new_client) => {
61- self . client = new_client;
62- self . current_app_id = new_app_id. to_string ( ) ;
63- self . connect ( ) ;
64- true
65- }
66- Err ( e) => {
67- tracing:: error!( "Failed to create Discord client with new app ID: {e}" ) ;
68- false
69- }
70- }
54+ self . client = DiscordIpcClient :: new ( new_app_id) ;
55+ self . current_app_id = new_app_id. to_string ( ) ;
56+ self . connect ( ) ;
7157 }
7258
7359 pub fn connect ( & mut self ) {
0 commit comments