我可以通过阅读 文档 很容易地制作一个机器人,但是 Jobqueue 没有按照它写的那样工作。 run_daily
方法使用 datetime.time
对象在特定时间发送消息,但此代码既不发送消息也不显示任何错误。它一直在运行
import datetime
from telegram import bot
from telegram.ext import Updater
def callback_minute(bot, job):
bot.send_message(chat_id=475838704, text='PlEaSe wOrK!')
def main():
updater = Updater()
bot = updater.bot
job = updater.job_queue
dispatcher = updater.dispatcher
job.run_daily(callback_minute, time=datetime.time(6,33,00))
updater.start_polling()
updater.idle()
if __name__ == '__main__':
main()
原文由 Rajas Rasam 发布,翻译遵循 CC BY-SA 4.0 许可协议
也许这会有所帮助:
对机器人说
/notify