I have really interesting situation with this code:
import asyncio
import config
from telebot.async_telebot import AsyncTeleBot
bot = AsyncTeleBot(config.Token)
@bot.message_handler(content_types=['text'])
async def check_message(message):
user = f'[{message.from_user.first_name}](tg://user?id={message.from_user.id})'
await bot.send_message(547348400, f'New mess from user {user} in chat "{message.chat.title}"nnusername: {message.from_user.username}nuser id: {message.from_user.id}nchat id: {message.chat.id}', parse_mode='Markdown')
async def bot_start():
await bot.polling(non_stop=True, request_timeout=90)
if __name__ == '__main__':
asyncio.run(bot_start())
If user has nine numbers in user_ID – it will be link, but if he has ten numbers in user ID – text.
How to decide this problem?
I have no ideas hot to decide it.
New contributor
Stepan Ershov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.