Home > Mobile >  I built a telegram bot but it doesn't work
I built a telegram bot but it doesn't work

Time:07-06

Hello everyone please I was working on a telegram bot, this bot works fine on my local pc but when I upload the file to my VPS it gives errors.

This a photo of it working on my local PC Photo Link

And here's the code also

from telegram.ext import Updater,CommandHandler

def start(update,context) -> None:
    message = update.message
    context.bot.send_message(message.chat.id,"hi",parse_mode="markdown")
        
def main():
    updater = Updater("5412956496:AAFkQCS-mKcqUm1PeRV3U8pjqGrN0k1KpI4",use_context=True)
    print("Started")
    updater.dispatcher.add_handler(CommandHandler('start', start))      
    updater.start_polling()

if _name_ == "_main_":
    main()
      

But on my VPS it gives me this error

File "app.py", line 2, in <module>
from telegram.ext import Updater,CommandHandler
File "/usr/local/lib/python3.6/dist-packages/telegram/ext/__init__.py", line 31, in <module>
from .updater import Updater
File "/usr/local/lib/python3.6/dist-packages/telegram/ext/updater.py", line 55, in <module>
class Updater(Generic[CCT, UD, CD, BD]):
File "/usr/local/lib/python3.6/dist-packages/telegram/ext/updater.py", line 198, in Updater
dispatcher: Dispatcher[CCT, UD, CD, BD] = None,
File "/usr/lib/python3.6/typing.py", line 682, in inner
return func(*args, **kwds)
File "/usr/lib/python3.6/typing.py", line 1143, in getitem
orig_bases=self.orig_bases)
File "/usr/lib/python3.6/typing.py", line 978, in new
self = super().new(cls, name, bases, namespace, _root=True)
File "/usr/lib/python3.6/typing.py", line 137, in new
return super().new(cls, name, bases, namespace)
File "/usr/lib/python3.6/abc.py", line 133, in new
cls = super().new(mcls, name, bases, namespace, **kwargs)
TypeError: dict slot disallowed: we already got one 

I really would appreciate help offered thank you.

CodePudding user response:

You should revoke the bot token that you posted.

Which version of python-telegram-bot are you using? v13.12 does not support python 3.6.


Disclaimer: I'm currently the maintainer of python-telegram-bot.

  • Related