Answer the question
In order to leave comments, you need to log in
Delete all user messages in Telegram group?
I'm trying to make it so that when I reply to a message with the text /start in the group - all messages of the person whose message I replied to - are deleted.
Below is a snippet of code that only works before the user id is printed. checked with a print if it recognizes id. recognizes .. and then - for some reason in any way .. I don’t see the problem
TELEBOT
@bot.message_handler(commands=["mute"]) #
def channel_message(message): #Создаем функцию
if message.from_user.id == config.admin_id:
if message.chat.type != "private":
print(message.reply_to_message.from_user.id)
for i in range(0, message.message_id):
try:
bot.delete_message(message.reply_to_message.from_user.id, i)
except:
pass
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question