SHARE
TWEET

Untitled

a guest Feb 14th, 2020 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @bot.on.chat_message(lev=["кик","kick"])
  2. async def ban(ans: Message):
  3.     if ans.reply_message:
  4.         if await check(ans):
  5.             if ans.reply_message.from_id!=-185367978:
  6.                 if await checkre(ans):
  7.                     await ans("Я не могу исключить администратора беседы")
  8.                 else:
  9.                     await ans("пока")
  10.                     await bot.api.messages.removeChatUser(chat_id=ans.peer_id-2000000000, member_id=ans.reply_message.from_id)
  11.             else:
  12.                 await ans("Ты еблан?")
  13.         else:
  14.             await ans("Ты не админ")
  15.     else:
  16.         await ans("Перешли сообщение того, кого нужно исключить из беседы")
  17.  
  18.  
  19. async def check(message: Message):
  20.     items = (await bot.api.messages.getConversationsById(peer_ids = message.peer_id))['items']
  21.     if not items: return False
  22.     chat_settings = items[0]['chat_settings']
  23.     is_admin = message.from_id == chat_settings['owner_id'] or message.from_id in chat_settings['admin_ids']
  24.     return is_admin
  25. async def checkre(message: Message):
  26.     items = (await bot.api.messages.getConversationsById(peer_ids = message.peer_id))['items']
  27.     if not items: return False
  28.     chat_settings = items[0]['chat_settings']
  29.     is_admin = message.reply_message.from_id == chat_settings['owner_id'] or message.reply_message.from_id in chat_settings['admin_ids']
  30.     return is_admin
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top