Skip to content
Advertisement

Make telebot mute new user for 24 hours

I have this code

import time
from time import time
bot = telebot.TeleBot('<MY-BOT-TOKEN>')
@bot.message_handler(content_types=[
    "new_chat_members"
])
def mut(message):
    bot.restrict_chat_member(message.chat.id, USER_ID , until_date=time()+86400)

It listens for new users, and it has mute command, but how can i get their ID with TeleBot?

Advertisement

Answer

def mut(message):
    bot.restrict_chat_member(message.chat.id, message.from_user.id, until_date=time()+86400)
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement