已经创建了一个机器人,它将在每周五运行,以检索联邦公开市场委员会的利率数据。
但是,终端出现在错误下面:
“没有注册错误处理程序,记录异常。”。
这是我的密码:
from telegram.ext import CommandHandler
from telegram.ext import Updater
import telegram
import datetime, pytz
import ws_bot_web_scraping
def print_CME_targetFedRate(context: telegram.ext.CallbackContext):
ws_bot_web_scraping.print_CME_targetFedRate(context)
#Server Start
#===========================================================
def server_start(update: telegram.Update, context: telegram.ext.CallbackContext):
print("Telegram_bot_misc Started.")
context.bot.send_message(chat_id=update.message.chat_id,text=':)')
context.job_queue.run_daily(print_CME_targetFedRate,datetime.time(hour=17, minute=33, tzinfo=pytz.timezone('Asia/Hong_Kong')),days=(4,),context=update.message.chat_id)
if __name__ == "__main__":
u = Updater('<myToken>', use_context=True)
j = u.job_queue
dispatcher = u.dispatcher
j.set_dispatcher(dispatcher)
timer_handler = CommandHandler('s', server_start)
u.dispatcher.add_handler(timer_handler)
u.start_polling()
j.start()
u.idle()

发布于 2021-08-08 18:43:50
异常只是告诉您,在ws_bot_web_scraping.print_CME_targetFedRate(context)调用中,行context.bot.sendMediaGroup(chat_id=context.job.context,media=media)失败了。电报报告的错误消息只是“组发送失败”。
从错误信息来看,媒体组为什么不能确切地发送是不清楚的,但从您的问题中也不清楚,因为您例如没有包括ws_bot_web_scraping.print_CME_targetFedRate的代码。
免责声明:我目前是python-telegram-bot的维护者
https://stackoverflow.com/questions/68679523
复制相似问题