@bot.message_handler(commands=["uid"])
def userid(message):
try:
chat_id = message.chat.id
message_id = message.message_id
bot.send_message(chat_id=chat_id, parse_mode='html', text=f'<code>\n{message.reply_to_message.from_user.id}</code>', reply_to_message_id=message_id)
except:
bot.send_message(chat_id=chat_id, parse_mode='html', text=f'<code>\n{message.from_user.id}</code>', reply_to_message_id=message_id)