@@ -131,7 +131,7 @@ async def get_buttons(key=None, edit_type=None):
131
131
buttons .ibutton ("Default" , f"botset resetnzb { key } " )
132
132
buttons .ibutton ("Empty String" , f"botset emptynzb { key } " )
133
133
buttons .ibutton ("Close" , "botset close" )
134
- msg = f"Send a valid value for { key } . Current value is '{ nzb_options [key ]} .\n If the value is list then seperate them by space or ,\n Example: .exe,info or .exe .info\n Timeout: 60 sec"
134
+ msg = f"Send a valid value for { key } . Current value is '{ nzb_options [key ]} ' .\n If the value is list then seperate them by space or ,\n Example: .exe,info or .exe .info\n Timeout: 60 sec"
135
135
elif edit_type .startswith ("nzbsevar" ):
136
136
index = 0 if key == "newser" else int (edit_type .replace ("nzbsevar" , "" ))
137
137
buttons .ibutton ("Back" , f"botset nzbser{ index } " )
@@ -211,7 +211,9 @@ async def get_buttons(key=None, edit_type=None):
211
211
msg = f"Sabnzbd Options | Page: { int (START / 10 )} | State: { STATE } "
212
212
elif key == "nzbserver" :
213
213
if len (config_dict ["USENET_SERVERS" ]) > 0 :
214
- for index , k in enumerate (config_dict ["USENET_SERVERS" ][START : 10 + START ]):
214
+ for index , k in enumerate (
215
+ config_dict ["USENET_SERVERS" ][START : 10 + START ]
216
+ ):
215
217
buttons .ibutton (k ["name" ], f"botset nzbser{ index } " )
216
218
buttons .ibutton ("Add New" , "botset nzbsevar newser" )
217
219
buttons .ibutton ("Back" , "botset nzb" )
@@ -440,7 +442,9 @@ async def edit_nzb_server(_, message, pre_message, key, index=0):
440
442
await update_buttons (pre_message , f"nzbser{ index } " )
441
443
await deleteMessage (message )
442
444
if DATABASE_URL :
443
- await DbManager ().update_config ({"USENET_SERVERS" : config_dict ["USENET_SERVERS" ]})
445
+ await DbManager ().update_config (
446
+ {"USENET_SERVERS" : config_dict ["USENET_SERVERS" ]}
447
+ )
444
448
await nzb_client .log_out ()
445
449
446
450
@@ -723,12 +727,16 @@ async def edit_bot_settings(client, query):
723
727
if DATABASE_URL :
724
728
await DbManager ().update_nzb_config ()
725
729
elif data [1 ] == "syncnzb" :
726
- await query .answer ("Syncronization Started. It takes up to 2 sec!" , show_alert = True )
730
+ await query .answer (
731
+ "Syncronization Started. It takes up to 2 sec!" , show_alert = True
732
+ )
727
733
await get_nzb_options ()
728
734
if DATABASE_URL :
729
735
await DbManager ().update_nzb_config ()
730
736
elif data [1 ] == "syncqbit" :
731
- await query .answer ("Syncronization Started. It takes up to 2 sec!" , show_alert = True )
737
+ await query .answer (
738
+ "Syncronization Started. It takes up to 2 sec!" , show_alert = True
739
+ )
732
740
await get_qb_options ()
733
741
if DATABASE_URL :
734
742
await DbManager ().save_qbit_settings ()
@@ -766,12 +774,16 @@ async def edit_bot_settings(client, query):
766
774
elif data [1 ] == "remser" :
767
775
index = int (data [2 ])
768
776
nz_client = get_sabnzb_client ()
769
- await nz_client .delete_config ("servers" , config_dict ["USENET_SERVERS" ][index ]["name" ])
777
+ await nz_client .delete_config (
778
+ "servers" , config_dict ["USENET_SERVERS" ][index ]["name" ]
779
+ )
770
780
del config_dict ["USENET_SERVERS" ][index ]
771
781
await update_buttons (message , "nzbserver" )
772
- if DATABASE_URL :
773
- await DbManager ().update_config ({"USENET_SERVERS" : config_dict ["USENET_SERVERS" ]})
774
782
await nz_client .log_out ()
783
+ if DATABASE_URL :
784
+ await DbManager ().update_config (
785
+ {"USENET_SERVERS" : config_dict ["USENET_SERVERS" ]}
786
+ )
775
787
elif data [1 ] == "private" :
776
788
await query .answer ()
777
789
await update_buttons (message , data [1 ])
@@ -851,11 +863,17 @@ async def edit_bot_settings(client, query):
851
863
await update_buttons (message , f"nzbser{ data [2 ]} " )
852
864
index = int (data [2 ])
853
865
nzb_client = get_sabnzb_client ()
854
- res = await nzb_client .add_server ({"name" : config_dict ["USENET_SERVERS" ][index ]['name' ], data [3 ]: "" })
855
- config_dict ["USENET_SERVERS" ][index ][data [3 ]] = res ['config' ]['servers' ][0 ][data [3 ]]
866
+ res = await nzb_client .add_server (
867
+ {"name" : config_dict ["USENET_SERVERS" ][index ]["name" ], data [3 ]: "" }
868
+ )
869
+ config_dict ["USENET_SERVERS" ][index ][data [3 ]] = res ["config" ]["servers" ][0 ][
870
+ data [3 ]
871
+ ]
856
872
await nzb_client .log_out ()
857
873
if DATABASE_URL :
858
- await DbManager ().update_config_dict ["USENET_SERVERS" ]()
874
+ await DbManager ().update_config (
875
+ {"USENET_SERVERS" : config_dict ["USENET_SERVERS" ]}
876
+ )
859
877
elif data [1 ].startswith ("nzbsevar" ) and (STATE == "edit" or data [2 ] == "newser" ):
860
878
index = 0 if data [2 ] == "newser" else int (data [1 ].replace ("nzbsevar" , "" ))
861
879
await query .answer ()
0 commit comments