简体   繁体   中英

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?

def mut(message):
    bot.restrict_chat_member(message.chat.id, message.from_user.id, until_date=time()+86400)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM