大家好,我正在制作一个电报机器人,这个机器人在我的本地pc上工作得很好,但是当我将文件上传到我的VPS时,它会给出错误。
这是它在我本地PC上工作的照片照片链接
这里也是代码
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()
但是在我的VPS上它给了我这个错误
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
我真的很感激你提供的帮助,谢谢。
您应该撤销您发布的bot令牌。
您使用的是哪个版本的python-telegram-bot
?V13.12 +不支持python 3.6.
免责声明:我目前是python-telegram-bot
的维护者。