Add kick/unban chat user method.

This commit is contained in:
Alex Root Junior 2017-06-02 01:28:00 +03:00
parent 93c61e9e0a
commit ff4d2652ab
2 changed files with 12 additions and 2 deletions

View file

@ -104,8 +104,8 @@ class ApiMethods:
SEND_CHAT_ACTION = 'sendChatAction'
GET_USER_PROFILE_PHOTOS = 'getUserProfilePhotos'
GET_FILE = 'getFile'
KICK_CHAT_MEMBER = 'kickChatMember' # TODO
UNBAN_CHAT_MEMBER = 'unbanChatMember' # TODO
KICK_CHAT_MEMBER = 'kickChatMember'
UNBAN_CHAT_MEMBER = 'unbanChatMember'
LEAVE_CHAT = 'leaveChat' # TODO
GET_CHAT = 'getChat'
GET_CHAT_ADMINISTRATORS = 'getChatAdministrators' # TODO

View file

@ -292,3 +292,13 @@ class AIOGramBot:
payload = generate_payload(**locals())
message = await self.request(ApiMethods.GET_FILE, payload)
return self.prepare_object(File.de_json(message))
async def kick_chat_user(self, chat_id, user_id):
payload = generate_payload(**locals())
await self.request(ApiMethods.KICK_CHAT_MEMBER, payload)
return True
async def unban_chat_member(self, chat_id, user_id):
payload = generate_payload(**locals())
await self.request(ApiMethods.UNBAN_CHAT_MEMBER, payload)
return True