father-bot / chatgpt_telegram_bot

💬 Telegram bot with ChatGPT, Python-based, using OpenAI's API.
https://t.me/chatgpt_karfly_bot
MIT License
5.2k stars 1.82k forks source link

not supported between instances of 'int' and 'str' #473

Closed cookins closed 5 months ago

cookins commented 5 months ago

Hey there. I'm using this bot for some time, but older version. Now i got new server and installed newer bot code, but getting error in telegram channel, while trying to chat with bot:

JSON:

update = {
  "update_id": 449******,
  "message": {
    "chat": {
      "id": 492*****,
      "type": "private",
      "first_name": "******",
      "username": "a*****"
    },
    "text": "Hi",
    "group_chat_created": false,
    "message_id": 62*,
    "delete_chat_photo": false,
    "date": 17******,
    "supergroup_chat_created": false,
    "channel_chat_created": false,
    "from": {
      "is_bot": false,
      "username": "a*******",
      "first_name": "*******",
      "id": 492*****,
      "language_code": "en"
    }
  }
}

Python:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/telegram/ext/_application.py", line 1104, in process_update
    await coroutine
  File "/usr/local/lib/python3.8/site-packages/telegram/ext/_handler.py", line 141, in handle_update
    return await self.callback(update, context)
  File "bot/bot.py", line 481, in message_handle
    await task
  File "bot/bot.py", line 368, in message_handle_fn
    if (datetime.now() - db.get_user_attribute(user_id, "last_interaction")).seconds > config.new_dialog_timeout and len(db.get_dialog_messages(user_id)) > 0:
TypeError: '>' not supported between instances of 'int' and 'str'

Versions conflict related issue? I composed it on freshly installed debian. Ty.

cookins commented 5 months ago

So in config, timeout string was with ; , by accident. Like 600; , which cause this issue