Skip to content

Commit

Permalink
Finally fixed bug:'NoneType' object is not subscriptable
Browse files Browse the repository at this point in the history
  • Loading branch information
karfly committed Mar 4, 2023
1 parent 0779808 commit ce29dfd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 4 additions & 0 deletions bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ async def register_user_if_not_exists(update: Update, context: CallbackContext,
first_name=user.first_name,
last_name= user.last_name
)
db.start_new_dialog(user.id)

if db.get_user_attribute(user.id, "current_dialog_id") is None:
db.start_new_dialog(user.id)


async def start_handle(update: Update, context: CallbackContext):
Expand Down
2 changes: 0 additions & 2 deletions bot/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ def add_new_user(

if not self.check_if_user_exists(user_id):
self.user_collection.insert_one(user_dict)

# TODO: maybe start a new dialog here?

def start_new_dialog(self, user_id: int):
self.check_if_user_exists(user_id, raise_exception=True)
Expand Down

0 comments on commit ce29dfd

Please sign in to comment.