2022-04-30 22:58:06 +03:00
|
|
|
from telebot.async_telebot import AsyncTeleBot
|
|
|
|
from telebot import formatting
|
|
|
|
|
|
|
|
bot = AsyncTeleBot('token')
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['start'])
|
|
|
|
async def start_message(message):
|
|
|
|
await bot.send_message(
|
|
|
|
message.chat.id,
|
|
|
|
# function which connects all strings
|
|
|
|
formatting.format_text(
|
2022-05-14 18:32:28 +03:00
|
|
|
formatting.mbold(message.from_user.first_name),
|
|
|
|
formatting.mitalic(message.from_user.first_name),
|
|
|
|
formatting.munderline(message.from_user.first_name),
|
|
|
|
formatting.mstrikethrough(message.from_user.first_name),
|
|
|
|
formatting.mcode(message.from_user.first_name),
|
2022-04-30 22:58:06 +03:00
|
|
|
separator=" " # separator separates all strings
|
|
|
|
),
|
|
|
|
parse_mode='MarkdownV2'
|
|
|
|
)
|
|
|
|
|
|
|
|
# just a bold text using markdownv2
|
|
|
|
await bot.send_message(
|
|
|
|
message.chat.id,
|
2022-05-14 18:32:28 +03:00
|
|
|
formatting.mbold(message.from_user.first_name),
|
2022-04-30 22:58:06 +03:00
|
|
|
parse_mode='MarkdownV2'
|
|
|
|
)
|
|
|
|
|
|
|
|
# html
|
|
|
|
await bot.send_message(
|
|
|
|
message.chat.id,
|
|
|
|
formatting.format_text(
|
2022-05-14 18:32:28 +03:00
|
|
|
formatting.hbold(message.from_user.first_name),
|
|
|
|
formatting.hitalic(message.from_user.first_name),
|
|
|
|
formatting.hunderline(message.from_user.first_name),
|
|
|
|
formatting.hstrikethrough(message.from_user.first_name),
|
|
|
|
formatting.hcode(message.from_user.first_name),
|
2022-05-21 15:45:59 +03:00
|
|
|
# hide_link is only for html
|
|
|
|
formatting.hide_link('https://telegra.ph/file/c158e3a6e2a26a160b253.jpg'),
|
2022-04-30 22:58:06 +03:00
|
|
|
separator=" "
|
|
|
|
),
|
|
|
|
parse_mode='HTML'
|
|
|
|
)
|
|
|
|
|
|
|
|
# just a bold text in html
|
|
|
|
await bot.send_message(
|
|
|
|
message.chat.id,
|
2022-05-14 18:32:28 +03:00
|
|
|
formatting.hbold(message.from_user.first_name),
|
2022-04-30 22:58:06 +03:00
|
|
|
parse_mode='HTML'
|
|
|
|
)
|
|
|
|
|
|
|
|
import asyncio
|
|
|
|
asyncio.run(bot.polling())
|