mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 12:18:59 +00:00
Add the ability to kick, ban and unban users from a server.
This commit is contained in:
parent
c98a723f06
commit
54fa8dea69
@ -576,3 +576,38 @@ class Client(object):
|
|||||||
url = '{}/{}'.format(endpoints.CHANNELS, channel.id)
|
url = '{}/{}'.format(endpoints.CHANNELS, channel.id)
|
||||||
response = requests.delete(url, headers=self.headers)
|
response = requests.delete(url, headers=self.headers)
|
||||||
|
|
||||||
|
def kick(self, server, user):
|
||||||
|
"""Kicks a :class:`User` from their respective :class:`Server`.
|
||||||
|
|
||||||
|
You must have the proper permissions to kick a user in the server.
|
||||||
|
|
||||||
|
:param server: The :class:`Server` to kick the member from.
|
||||||
|
:param user: The :class:`User` to kick.
|
||||||
|
"""
|
||||||
|
|
||||||
|
url = '{base}/{server}/members/{user}'.format(base=endpoints.SERVERS, server=server.id, user=user.id)
|
||||||
|
response = requests.delete(url, headers=self.headers)
|
||||||
|
|
||||||
|
def ban(self, server, user):
|
||||||
|
"""Bans a :class:`User` from their respective :class:`Server`.
|
||||||
|
|
||||||
|
You must have the proper permissions to ban a user in the server.
|
||||||
|
|
||||||
|
:param server: The :class:`Server` to ban the member from.
|
||||||
|
:param user: The :class:`User` to ban.
|
||||||
|
"""
|
||||||
|
|
||||||
|
url = '{base}/{server}/bans/{user}'.format(base=endpoints.SERVERS, server=server.id, user=user.id)
|
||||||
|
response = requests.put(url, headers=self.headers)
|
||||||
|
|
||||||
|
def unban(self, server, name):
|
||||||
|
"""Unbans a :class:`User` from their respective :class:`Server`.
|
||||||
|
|
||||||
|
You must have the proper permissions to unban a user in the server.
|
||||||
|
|
||||||
|
:param server: The :class:`Server` to unban the member from.
|
||||||
|
:param user: The :class:`User` to unban.
|
||||||
|
"""
|
||||||
|
|
||||||
|
url = '{base}/{server}/bans/{user}'.format(base=endpoints.SERVERS, server=server.id, user=user.id)
|
||||||
|
response = requests.delete(url, headers=self.headers)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user