@@ -37,7 +37,7 @@ def __new__(
3737 else :
3838 cls .db_path = db_file_path
3939
40- cls .db = SqliteDict (cls .db_path , outer_stack = False , autocommit = True )
40+ cls .db = SqliteDict (cls .db_path , outer_stack = True , autocommit = True )
4141 if (
4242 load_from_json_if_not_init
4343 and not cls .db
@@ -50,7 +50,7 @@ def __new__(
5050 cls .db [key ] = value
5151
5252 cls .ch = ConfigHandle ()
53- atexit .register (UserHandle ._cleanup , cls .db )
53+ atexit .register (UserHandle ._cleanup , cls .db )
5454 return cls ._instance
5555
5656 """
@@ -357,7 +357,7 @@ def addUserVoice(self, userID: int | str, voice: int | str = 1):
357357 """
358358 self .addNewDataEntry (userID )
359359 entry = self .db [str (userID )]
360- entry ["Voice" ] += int (voice )
360+ entry ["Voice" ] = int ( entry [ "Voice" ]) + int (voice )
361361 self .db [str (userID )] = entry
362362
363363 def addUserText (self , userID : int | str , text : str | int ):
@@ -369,7 +369,7 @@ def addUserText(self, userID: int | str, text: str | int):
369369 """
370370 self .addNewDataEntry (userID )
371371 entry = self .db [str (userID )]
372- entry ["Text" ] += int (text )
372+ entry ["Text" ] = int ( entry [ "Text" ]) + int (text )
373373 self .db [str (userID )] = entry
374374
375375 def addUserTextCount (self , userID : int | str , count : int | str = 1 ):
@@ -382,7 +382,7 @@ def addUserTextCount(self, userID: int | str, count: int | str = 1):
382382 """
383383 self .addNewDataEntry (userID )
384384 entry = self .db [str (userID )]
385- entry ["TextCount" ] += int (count )
385+ entry ["TextCount" ] = int ( entry [ "TextCount" ]) + int (count )
386386 self .db [str (userID )] = entry
387387
388388 @classmethod
@@ -394,5 +394,6 @@ def _cleanup(cls, db):
394394 Keyword arguments:
395395 db -- SqliteDict database object, which should be closed.
396396 """
397+ print ("[UserHandle] Closing Databank" )
397398 db .commit ()
398399 db .close ()
0 commit comments