diff options
| author | Nadir Chowdhury <[email protected]> | 2021-02-25 02:26:51 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-02-24 21:26:51 -0500 |
| commit | 63ec23bac24ab62633bdb8fd19b93ecd3fddba7c (patch) | |
| tree | 14ad9433dddf4c056c292a07e2c0e74b79942cdd /discord/client.py | |
| parent | Fix NameError with invoked_parents (diff) | |
| download | discord.py-63ec23bac24ab62633bdb8fd19b93ecd3fddba7c.tar.xz discord.py-63ec23bac24ab62633bdb8fd19b93ecd3fddba7c.zip | |
Code optimisations and refactoring via Sourcery
Diffstat (limited to 'discord/client.py')
| -rw-r--r-- | discord/client.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/discord/client.py b/discord/client.py index 85035535..8ea1cf30 100644 --- a/discord/client.py +++ b/discord/client.py @@ -754,9 +754,7 @@ class Client: @allowed_mentions.setter def allowed_mentions(self, value): - if value is None: - self._connection.allowed_mentions = value - elif isinstance(value, AllowedMentions): + if value is None or isinstance(value, AllowedMentions): self._connection.allowed_mentions = value else: raise TypeError('allowed_mentions must be AllowedMentions not {0.__class__!r}'.format(value)) @@ -1227,15 +1225,13 @@ class Client: if icon is not None: icon = utils._bytes_to_base64_data(icon) - if region is None: - region = VoiceRegion.us_west.value - else: - region = region.value + region = region or VoiceRegion.us_west + region_value = region.value if code: - data = await self.http.create_from_template(code, name, region, icon) + data = await self.http.create_from_template(code, name, region_value, icon) else: - data = await self.http.create_guild(name, region, icon) + data = await self.http.create_guild(name, region_value, icon) return Guild(data=data, state=self._connection) # Invite management |