Browse Source

Remove duplicated create_channel function.

pull/8/head
Rapptz 10 years ago
parent
commit
6c54b24a6f
  1. 24
      discord/client.py

24
discord/client.py

@ -609,30 +609,6 @@ class Client(object):
log.info('{0.__name__} has successfully been registered as an event'.format(function))
return function
def create_channel(self, server, name, type='text'):
"""Creates a channel in the specified server.
In order to create the channel the client must have the proper permissions.
:param server: The :class:`Server` to create the channel from.
:param name: The name of the channel to create.
:param type: The type of channel to create. Valid values are 'text' or 'voice'.
:returns: The recently created :class:`Channel`.
"""
url = '{}/{}/channels'.format(endpoints.SERVERS, server.id)
payload = {
'name': name,
'type': type
}
response = requests.post(url, json=payload, headers=self.headers)
if response.status_code == 200:
data = response.json()
log.debug(request_success_log.format(name='create_channel', response=response, json=payload, data=data))
channel = Channel(server=server, **data)
return channel
else:
log.error(request_logging_format.format(response=response, name='create_channel'))
def delete_channel(self, channel):
"""Deletes a channel.

Loading…
Cancel
Save