Guest User

Untitled

a guest
Aug 13th, 2020
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. #Импорт библиотек
  2. from aiogram import Bot, types
  3. from aiogram.dispatcher import Dispatcher
  4. from aiogram.utils import executor
  5. from aiogram.types import ReplyKeyboardRemove, \
  6. ReplyKeyboardMarkup, KeyboardButton, \
  7. InlineKeyboardMarkup, InlineKeyboardButton
  8.  
  9. #Клавиатура
  10. imnobot = InlineKeyboardButton('Я не бот', callback_data='imnobot')
  11. imnotbotm = InlineKeyboardMarkup().add(imnobot)
  12.  
  13. #Переменные
  14. bot = Bot(token="1311051972")
  15. admin = 1106798480
  16. post11x = Dispatcher(bot)
  17. post = "-1001332665310"
  18.  
  19. #Получаем уведомление о входе
  20. @post11x.message_handler(content_types=[types.ContentType.NEW_CHAT_MEMBERS])
  21. async def new_user(msg: types.ContentType.NEW_CHAT_MEMBERS):
  22. login = msg.from_user.first_name
  23. user_id = msg.from_user.id
  24. await bot.send_message(post, login + ", добро пожаловать в беседу", reply_markup=imnotbotm)
  25. await bot.restrict_сhatmember(post, user_id, can_pin_messages)
  26.  
  27. #Поддержание работы бота
  28. if "main" == 'main':
  29. executor.start_polling(post11x)
Advertisement
Add Comment
Please, Sign In to add comment