raisevalueerror('token'或'bot'必须传递吗?

kt06eoxx  于 2021-09-08  发布在  Java
关注(0)|答案(0)|浏览(203)

我现在建立了一个pbt,现在想使用终端启动bot服务,它很好,到目前为止可以在vs代码中完美地执行。然而,当我运行它时,它在“terlminal”中不起作用

python3 TelegramBot.py

结果显示有以下错误:“必须传递令牌”或“bot”

为什么机器人可以在vs代码执行中工作,但不能在终端上工作?我该怎么办?

def main():
updater = Updater(API_KEY,use_context=True) #This statement is to start the bot
dp = updater.dispatcher

# Add handler here to active the trigger in here ....

dp.add_handler(CommandHandler("start",start_command))
dp.add_handler(CommandHandler("help",help_command))
dp.add_handler(CommandHandler("fc",fc_check))
dp.add_handler(CommandHandler("caps",caps))
dp.add_handler(MessageHandler(Filters.text,handle_message))
dp.add_error_handler(error)

updater.start_polling() #Put the time interval that want the bot to check for update ,etc. 5 seconds

logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)

updater.idle()          #To make sure the bot continues to stay active, even nothing is happening

main()

谢谢

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题