Remove duplicated create_channel function.
This commit is contained in:
parent
a4c152cebc
commit
6c54b24a6f
@ -609,30 +609,6 @@ class Client(object):
|
|||||||
log.info('{0.__name__} has successfully been registered as an event'.format(function))
|
log.info('{0.__name__} has successfully been registered as an event'.format(function))
|
||||||
return 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):
|
def delete_channel(self, channel):
|
||||||
"""Deletes a channel.
|
"""Deletes a channel.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user