@@ -17,16 +17,16 @@ def __init__(self, db_path:str, account_db:str):
1717 user_data = json .load (f )
1818
1919 def save (self ):
20- with open (self .db_path , 'w+' ) as f : json .dump (accounts , indent = 4 )
21- with open (self .db_path , 'w+' ) as f : json .dump (user_data , indent = 4 )
20+ with open (self .db_path , 'w+' ) as f : json .dump (accounts , f , indent = 4 )
21+ with open (self .account_db , 'w+' ) as f : json .dump (user_data , f , indent = 4 )
2222
2323 def register (self , discord_id :int , auth_id :int ):
2424 if disabled : return "[!] IsoBank is currently disabled."
2525 if discord_id in accounts : return "[!] That user is already registered!"
2626 user_count = len (accounts .keys ())
2727 new_id = user_count + 1
28- if not auth_id .isdigit (): return "\" auth_id\" is not an integer."
29- if len (auth_id ) != 6 : return "\" auth_id\" must be passed as a 6-digit number."
28+ if not str ( auth_id ) .isdigit (): return "\" auth_id\" is not an integer."
29+ if len (str ( auth_id ) ) != 6 : return "\" auth_id\" must be passed as a 6-digit number."
3030 accounts [str (new_id )] = {"discord_ids" : [discord_id ], "auth_id" : auth_id }
3131 user_data [str (new_id )] = {"deposited" : 0 }
3232 self .save ()
@@ -37,5 +37,7 @@ def authorize(self, discord_id:int, account_id:int, auth_id:int):
3737 if disabled : return "[!] IsoBank is currently disabled."
3838 wacc = accounts [str (account_id )]
3939 if wacc ["auth_id" ] != auth_id : return "Incorrect auth ID"
40- if discord_id not in wacc ["discord_ids" ]: wacc ["discord_ids" ].append (discord_id )
40+ if discord_id not in wacc ["discord_ids" ]:
41+ wacc ["discord_ids" ].append (discord_id )
42+ self .save ()
4143 return wacc
0 commit comments