mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-07 02:21:54 +00:00
Don't assume that any shared fields are optional in Client.edit_channel.
Thanks Jake and night.
This commit is contained in:
parent
eeba4963f3
commit
2ebc0ab218
@ -1522,8 +1522,10 @@ class Client:
|
|||||||
Editing the channel failed.
|
Editing the channel failed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if 'name' not in options:
|
keys = ('name', 'topic', 'position')
|
||||||
options['name'] = channel.name
|
for key in keys:
|
||||||
|
if key not in options:
|
||||||
|
options[key] = getattr(channel, key)
|
||||||
|
|
||||||
yield from self.http.edit_channel(channel.id, **options)
|
yield from self.http.edit_channel(channel.id, **options)
|
||||||
|
|
||||||
|
@ -339,7 +339,7 @@ class HTTPClient:
|
|||||||
def edit_channel(self, channel_id, **options):
|
def edit_channel(self, channel_id, **options):
|
||||||
url = '{0.CHANNELS}/{1}'.format(self, channel_id)
|
url = '{0.CHANNELS}/{1}'.format(self, channel_id)
|
||||||
|
|
||||||
valid_keys = ('name', 'topic', 'bitrate', 'user_limit')
|
valid_keys = ('name', 'topic', 'bitrate', 'user_limit', 'position')
|
||||||
payload = {
|
payload = {
|
||||||
k: v for k, v in options.items() if k in valid_keys
|
k: v for k, v in options.items() if k in valid_keys
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user