Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Импорт библиотек
- from aiogram import Bot, types
- from aiogram.dispatcher import Dispatcher
- from aiogram.utils import executor
- from aiogram.types import ReplyKeyboardRemove, \
- ReplyKeyboardMarkup, KeyboardButton, \
- InlineKeyboardMarkup, InlineKeyboardButton
- #Клавиатура
- imnobot = InlineKeyboardButton('Я не бот', callback_data='imnobot')
- imnotbotm = InlineKeyboardMarkup().add(imnobot)
- #Переменные
- bot = Bot(token="1311051972")
- admin = 1106798480
- post11x = Dispatcher(bot)
- post = "-1001332665310"
- #Получаем уведомление о входе
- @post11x.message_handler(content_types=[types.ContentType.NEW_CHAT_MEMBERS])
- async def new_user(msg: types.ContentType.NEW_CHAT_MEMBERS):
- login = msg.from_user.first_name
- user_id = msg.from_user.id
- await bot.send_message(post, login + ", добро пожаловать в беседу", reply_markup=imnotbotm)
- await bot.restrict_сhatmember(post, user_id, can_pin_messages)
- #Поддержание работы бота
- if "main" == 'main':
- executor.start_polling(post11x)
Advertisement
Add Comment
Please, Sign In to add comment