Answer the question
In order to leave comments, you need to log in
How to send a message to a user with a delay?
How to send message to user after n seconds (not time.sleep)?
I used telegram.ext.JobQueue (I found it somewhere on the Internet), but something does not work, the bot is silent I
took the information from here: https://github.com/python-telegram-bot/python-tele...
ps - I I don’t tolerate documentation without illustrative examples, so don’t judge strictly)
@bot.message_handler(commands=['start'])
def welcome(message):
bot.send_message(message.chat.id, ...)
j.run_once(callback_1, 10)
def callback_1(context): #На context: telegram.ext.CallbackContext компилятор ругается
context.bot.send_message(chat_user_id, text='...')
Answer the question
In order to leave comments, you need to log in
from telegram.ext import Updater, CallbackContext
u = Updater(config.TOKEN, use_context=True)
j = u.job_queue
@bot.message_handler(commands=['start'])
def welcome(message):
bot.send_message(message.chat.id, '...')
j.run_once(callback_1, 10, context=message.chat.id)
def callback_1(context: CallbackContext):
context.bot.send_message(chat_id=context.job.context, text='...')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question