2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 21:07:59 +00:00

Make kick_chat_member return the "user kicked" message

This commit is contained in:
Dan 2018-10-21 09:40:49 +02:00
parent 077e7c00d5
commit b12c87f50a

View File

@ -17,6 +17,7 @@
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>. # along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from pyrogram.api import functions, types from pyrogram.api import functions, types
from pyrogram.client.ext import utils
from ...ext import BaseClient from ...ext import BaseClient
@ -58,7 +59,7 @@ class KickChatMember(BaseClient):
user_peer = self.resolve_peer(user_id) user_peer = self.resolve_peer(user_id)
if isinstance(chat_peer, types.InputPeerChannel): if isinstance(chat_peer, types.InputPeerChannel):
self.send( r = self.send(
functions.channels.EditBanned( functions.channels.EditBanned(
channel=chat_peer, channel=chat_peer,
user_id=user_peer, user_id=user_peer,
@ -76,11 +77,17 @@ class KickChatMember(BaseClient):
) )
) )
else: else:
self.send( r = self.send(
functions.messages.DeleteChatUser( functions.messages.DeleteChatUser(
chat_id=abs(chat_id), chat_id=abs(chat_id),
user_id=user_peer user_id=user_peer
) )
) )
return True for i in r.updates:
if isinstance(i, (types.UpdateNewMessage, types.UpdateNewChannelMessage)):
return utils.parse_messages(
self, i.message,
{i.id: i for i in r.users},
{i.id: i for i in r.chats}
)