Add support for voice channel user limits.
This commit is contained in:
		| @@ -80,6 +80,8 @@ class Channel(Hashable): | |||||||
|     voice_members |     voice_members | ||||||
|         A list of :class:`Members` that are currently inside this voice channel. |         A list of :class:`Members` that are currently inside this voice channel. | ||||||
|         If :attr:`type` is not :attr:`ChannelType.voice` then this is always an empty array. |         If :attr:`type` is not :attr:`ChannelType.voice` then this is always an empty array. | ||||||
|  |     user_limit : int | ||||||
|  |         The channel's limit for number of members that can be in a voice channel. | ||||||
|     """ |     """ | ||||||
|  |  | ||||||
|     def __init__(self, **kwargs): |     def __init__(self, **kwargs): | ||||||
| @@ -98,6 +100,7 @@ class Channel(Hashable): | |||||||
|         self.position = kwargs.get('position') |         self.position = kwargs.get('position') | ||||||
|         self.bitrate = kwargs.get('bitrate') |         self.bitrate = kwargs.get('bitrate') | ||||||
|         self.type = kwargs.get('type') |         self.type = kwargs.get('type') | ||||||
|  |         self.user_limit = kwargs.get('user_limit') | ||||||
|         try: |         try: | ||||||
|             self.type = ChannelType(self.type) |             self.type = ChannelType(self.type) | ||||||
|         except: |         except: | ||||||
|   | |||||||
| @@ -1614,6 +1614,10 @@ class Client: | |||||||
|             The new channel's position in the GUI. |             The new channel's position in the GUI. | ||||||
|         topic : str |         topic : str | ||||||
|             The new channel's topic. |             The new channel's topic. | ||||||
|  |         bitrate : int | ||||||
|  |             The new channel's bitrate. Voice only. | ||||||
|  |         user_limit : int | ||||||
|  |             The new channel's user limit. Voice only. | ||||||
|  |  | ||||||
|         Raises |         Raises | ||||||
|         ------ |         ------ | ||||||
| @@ -1627,9 +1631,17 @@ class Client: | |||||||
|         payload = { |         payload = { | ||||||
|             'name': options.get('name', channel.name), |             'name': options.get('name', channel.name), | ||||||
|             'topic': options.get('topic', channel.topic), |             'topic': options.get('topic', channel.topic), | ||||||
|             'position': options.get('position', channel.position) |             'position': options.get('position', channel.position), | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         user_limit = options.get('user_limit') | ||||||
|  |         if user_limit is not None: | ||||||
|  |             payload['user_limit'] = user_limit | ||||||
|  |  | ||||||
|  |         bitrate = options.get('bitrate') | ||||||
|  |         if bitrate is not None: | ||||||
|  |             payload['bitrate'] = bitrate | ||||||
|  |  | ||||||
|         r = yield from self.session.patch(url, data=utils.to_json(payload), headers=self.headers) |         r = yield from self.session.patch(url, data=utils.to_json(payload), headers=self.headers) | ||||||
|         log.debug(request_logging_format.format(method='PATCH', response=r)) |         log.debug(request_logging_format.format(method='PATCH', response=r)) | ||||||
|         yield from utils._verify_successful_response(r) |         yield from utils._verify_successful_response(r) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user