from telethon.tl.types import ChatParticipantCreator, ChatParticipantAdmin
for user in client.get_participants(chat, aggressive=True):
if isinstance(user.participant, ChatParticipantAdmin) or isinstance(user.participant, ChatParticipantCreator):
print(user.first_name)@bot.message_handler(commands=['go'])
def mess1(message):
msg = bot.send_message(message.chat.id, "Привет!")
print("ГОТОВО")
bot.register_next_step_handler(msg, mess2)
def mess2(message):
bot.send_message(message.chat.id, "как дела?")
print("ГОТОВО") @dp.message_handler(commands=['help'])
@dp.message_handler(lambda message: message.text and 'статистика оценок' in message.text.lower()) media = types.MediaGroup()
media.attach_photo(types.InputFile('media/Starbucks_Logo.jpg'), 'Превосходная фотография')
media.attach_photo(types.InputFile('media/Starbucks_Logo_2.jpg'), 'Превосходная фотография 2')
await bot.send_media_group(call.message.chat.id, media=media)pip uninstall telebot
pip install pytelegrambotapi -Uswitch_inline_query_current_chat равным, допустим, "Аккумуляторы"@bot.message_handler(commands=['start'])
def send_start(message):
markup = InlineKeyboardMarkup()
markup.add(InlineKeyboardButton('Аккумуляторы', switch_inline_query_current_chat='Аккумуляторы'))
bot.send_message(message.chat.id, 'Товары', reply_markup=markup)
@bot.inline_handler(lambda query: query.query == 'Аккумуляторы')
def query_video(inline_query):
r = InlineQueryResultArticle('1', 'SONY VTC6 3000 mah 30A 18650', InputTextMessageContent('Аккумулятор 1'), description='blah', url='https://buy-battery.com/goods/1', hide_url=True, thumb_url='https://via.placeholder.com/50')
r2 = InlineQueryResultArticle('2', 'SONY VTC5A 2600 mah 35A 18650', InputTextMessageContent('Аккумулятор 2'), description='blah', url='https://buy-battery.com/goods/2', hide_url=True, thumb_url='https://via.placeholder.com/50')
bot.answer_inline_query(inline_query.id, [r, r2])msg.reply_markup.rows[0].buttons[0].urlimport re
msg = '''[Message(id=899, peer_id=PeerUser(user_id=7415649360), date=datetime.datetime(2021, 8, 10, 9, 52, 37, tzinfo=datetime.timezone.utc), message='⚠️ WARNING: The following is a third party advertisement. Do not trust anything that promises to make you money. Use the following website at your own risk.\n--------------------- \n\nFree 100 OZC, price listing $30/OZC \n\nStart in 15/07/2021: Free 100 OZC, price listing $30/OZC \n \n--------------------- \nPress the "Visit website" button to earn LTC.\nYou will be redirected to a third party site.', out=False, mentioned=False, media_unread=False, silent=False, post=False, from_scheduled=False, legacy=False, edit_hide=False, pinned=False, from_id=None, fwd_from=None, via_bot_id=None, reply_to=None, media=None, reply_markup=ReplyInlineMarkup(rows=[KeyboardButtonRow(buttons=[KeyboardButtonUrl(text=' Go to website', url='https://doge.click/visit/Ka1gfo')]), KeyboardButtonRow(buttons=[KeyboardButtonCallback(text=' Report', data=b'{"name":"ReportClick","id":"click_tasks61124bf44b4413.68559229"}', requires_password=False), KeyboardButtonCallback(text='⏩ Skip', data=b'{"name":"SkipClick","id":"click_tasks61124bf44b4413.68559229"}', requires_password=False)])]), entities=[MessageEntityItalic(offset=0, length=156), MessageEntityItalic(offset=157, length=21), MessageEntityBold(offset=182, length=35), MessageEntityItalic(offset=283, length=21), MessageEntityItalic(offset=307, length=45), MessageEntityItalic(offset=353, length=45)], views=None, forwards=None, replies=None, edit_date=None, post_author=None, grouped_id=None, restriction_reason=[], ttl_period=None), total=57]'''
print(re.search(r'(https://.+?)\'', msg).group(1)) Мне надо что бы я смог изменить шрифт текста, который я вывожу в телеграмме, а именно жирний шрифт и подчёркнутый текст.
send_message передайте аргумент parse_mode, вам подойдет обычный "Markdown"bot.send_message(chat_id, 'Обычный текст\n*Жирный*\n__подчерктнутый__', parse_mode='Markdown')Так же мне надо в одно сообщение вставить стикеры
# sendSticker
sti = open('/tmp/sti.webp', 'rb')
tb.send_sticker(chat_id, sti)
tb.send_sticker(chat_id, "FILEID")fileid.@bot.message_handler(content_types=['sticker'])
def send_sticker_id(message):
bot.send_message(message.chat.id, f'This sticker id: {message.sticker.file_id}')bot.send_sticker(chat_id, sticker_id), где sticker_id - id, который получили из кода выше