не дожидаясь ответа пользователя
bot.register_next_step_handler()
bot.send_message(message.chat.id, invite_link.invite_link)
Following a link with the start parameter will open a one-on-one conversation with the bot, showing a START button in the place of the input field. If the startgroup parameter is used, the user is prompted to select a group to add the bot to. As soon as a user confirms the action (presses the START button in their app or selects a group to add the bot to), your bot will receive a message from that user in this format:
/start PAYLOAD
помощью бота прочитать сообщения от бота
response = bot.getUpdates()
for resp in response:
print(resp['message'].get('text'))
import telebot
token = 'XXX'
channel = '@XYZ'
bot = telebot.TeleBot(token)
print(bot.get_chat_member_count(channel))
from telethon import TelegramClient, sync
from telethon.tl.functions.channels import GetFullChannelRequest
api_id = ZZZ
api_hash = 'YYY'
channel_name = 'XXX'
client = TelegramClient('session_name', api_id, api_hash)
client.start()
channel_connect = client.get_entity(channel_name)
channel_full_info = client(GetFullChannelRequest(channel=channel_connect))
print(channel_full_info.full_chat.participants_count)
@bot.callback_query_handler(func=lambda call: call.data != "short")
def callback_inline(call): #функция обработчик callback данных пользовательского выбора
try:
if call.message:
if call.data == "Yes": #если выбор "Да" то запускается функция со второй клавиатурой
return response_data(call.message.chat.id)
elif call.data == "No":
bot.send_message(call.message.chat.id, "Попробуйте ещё раз")
except Exception as e:
print(repr(e))
call.data == ‘long’