相关疑难解决方法(0)

(python) Telegram bot-如何定期发送消息?

我对我的电报机器人进退两难。假设我必须创建一个函数来询问连接到机器人的每个用户,每周/每月一次,一个问题:

def check_the_week(bot, update):
reply_keyboard = [['YES', 'NO']]
bot.send_message(
    chat_id=update.message.chat_id,
    text=report,

    reply_markup=ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True))  # sends the total nr of hours
update.reply_text("Did you report all you working hour on freshdesk for this week?",
                  ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True))

if update.message.text == "YES":
    update.message.reply_text(text="Are you sure?",
                              reply_markup=ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True))

    # Asks confirmation
    if update.message.text == "YES":
        update.message.reply_text(text="Thank you for reporting your working hours in time!")

    elif update.message.text == "NO":
        update.message.reply_text(text="Please, check you time reports and add missing")

elif update.message.text == "NO":
    update.message.reply_text(text="Please, check you time reports …
Run Code Online (Sandbox Code Playgroud)

python telegram python-telegram-bot telegram-bot

7
推荐指数
2
解决办法
2万
查看次数