Fix Client.create_server.

Client was using .name of enum instead of .value, resulting in
invalid requests being sent to discord.
edit_server region changing was not broken as the region field
was str()'d, which uses .value.

Also document that most bot accounts cannot use create_server.
This commit is contained in:
khazhyk 2017-01-22 12:57:11 -08:00
parent ea95d723e8
commit d409196d3d

View File

@ -2242,6 +2242,9 @@ class Client:
Creates a :class:`Server`. Creates a :class:`Server`.
Bot accounts generally are not allowed to create servers.
See Discord's official documentation for more info.
Parameters Parameters
---------- ----------
name : str name : str
@ -2270,9 +2273,9 @@ class Client:
icon = utils._bytes_to_base64_data(icon) icon = utils._bytes_to_base64_data(icon)
if region is None: if region is None:
region = ServerRegion.us_west.name region = ServerRegion.us_west.value
else: else:
region = region.name region = region.value
data = yield from self.http.create_server(name, region, icon) data = yield from self.http.create_server(name, region, icon)
return Server(**data) return Server(**data)