From 8df5e2d24d0f6ea90e5927ed6529a445860fd7e8 Mon Sep 17 00:00:00 2001 From: TanNhatCMS <113796420+TanNhatCMS@users.noreply.github.com> Date: Tue, 20 Jun 2023 15:50:03 +0700 Subject: [PATCH] fix argument of type 'float' is not iterable (#211) * fix argument of type 'float' is not iterable fix "argument of type 'float' is not iterable" in show_balance_handle and message_handle * Update bot.py --- bot/bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/bot.py b/bot/bot.py index 2e0f28a..034e9a8 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -94,7 +94,7 @@ async def register_user_if_not_exists(update: Update, context: CallbackContext, # back compatibility for n_used_tokens field n_used_tokens = db.get_user_attribute(user.id, "n_used_tokens") - if isinstance(n_used_tokens, int): # old format + if isinstance(n_used_tokens, int) or isinstance(n_used_tokens, float): # old format new_n_used_tokens = { "gpt-3.5-turbo": { "n_input_tokens": 0, @@ -705,4 +705,4 @@ def run_bot() -> None: if __name__ == "__main__": - run_bot() \ No newline at end of file + run_bot()