Fix start command fail cause of bad language on user object
This commit is contained in:
parent
65a8702d25
commit
b8e018e4ca
1 changed files with 4 additions and 1 deletions
5
bot.py
5
bot.py
|
@ -125,7 +125,10 @@ async def start(message: types.Message):
|
|||
with shelve.open("edt", writeback=True) as db:
|
||||
if user_id not in db:
|
||||
logger.info(f"{message.from_user.username} add to the db")
|
||||
lg = message.from_user.locale.language if message.from_user.locale.language else ""
|
||||
if message.from_user.locale and message.from_user.locale.language:
|
||||
lg = message.from_user.locale.language
|
||||
else:
|
||||
lg = ""
|
||||
db[user_id] = User(int(user_id), lg)
|
||||
user = db[user_id]
|
||||
key = reply_keyboard.ReplyKeyboardMarkup()
|
||||
|
|
Reference in a new issue