aboutsummaryrefslogtreecommitdiff
path: root/discord/role.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-04-08 06:02:47 -0400
committerRapptz <[email protected]>2021-04-08 06:02:47 -0400
commit99fc9505107183faa59aad9e7753f293eba88836 (patch)
treef615ac678c5dc194fd2aa3a9a048a188b761b0d9 /discord/role.py
parentUpdate joined command in basic_bot to use f-strings (diff)
downloaddiscord.py-99fc9505107183faa59aad9e7753f293eba88836.tar.xz
discord.py-99fc9505107183faa59aad9e7753f293eba88836.zip
Use f-strings in more places that were missed.
Diffstat (limited to 'discord/role.py')
-rw-r--r--discord/role.py33
1 files changed, 26 insertions, 7 deletions
diff --git a/discord/role.py b/discord/role.py
index 37fa8f8b..c1060ace 100644
--- a/discord/role.py
+++ b/discord/role.py
@@ -33,6 +33,7 @@ __all__ = (
'Role',
)
+
class RoleTags:
"""Represents tags on a role.
@@ -52,7 +53,11 @@ class RoleTags:
The integration ID that manages the role.
"""
- __slots__ = ('bot_id', 'integration_id', '_premium_subscriber',)
+ __slots__ = (
+ 'bot_id',
+ 'integration_id',
+ '_premium_subscriber',
+ )
def __init__(self, data):
self.bot_id = _get_as_snowflake(data, 'bot_id')
@@ -76,8 +81,11 @@ class RoleTags:
return self.integration_id is not None
def __repr__(self):
- return '<RoleTags bot_id={0.bot_id} integration_id={0.integration_id} ' \
- 'premium_subscriber={1}>'.format(self, self.is_premium_subscriber())
+ return (
+ f'<RoleTags bot_id={self.bot_id} integration_id={self.integration_id} '
+ f'premium_subscriber={self.is_premium_subscriber()}>'
+ )
+
class Role(Hashable):
"""Represents a Discord role in a :class:`Guild`.
@@ -138,8 +146,19 @@ class Role(Hashable):
The role tags associated with this role.
"""
- __slots__ = ('id', 'name', '_permissions', '_colour', 'position',
- 'managed', 'mentionable', 'hoist', 'guild', 'tags', '_state')
+ __slots__ = (
+ 'id',
+ 'name',
+ '_permissions',
+ '_colour',
+ 'position',
+ 'managed',
+ 'mentionable',
+ 'hoist',
+ 'guild',
+ 'tags',
+ '_state',
+ )
def __init__(self, *, guild, state, data):
self.guild = guild
@@ -151,7 +170,7 @@ class Role(Hashable):
return self.name
def __repr__(self):
- return '<Role id={0.id} name={0.name!r}>'.format(self)
+ return f'<Role id={self.id} name={self.name!r}>'
def __lt__(self, other):
if not isinstance(other, Role) or not isinstance(self, Role):
@@ -346,7 +365,7 @@ class Role(Hashable):
'permissions': str(fields.get('permissions', self.permissions).value),
'color': colour.value,
'hoist': fields.get('hoist', self.hoist),
- 'mentionable': fields.get('mentionable', self.mentionable)
+ 'mentionable': fields.get('mentionable', self.mentionable),
}
data = await self._state.http.edit_role(self.guild.id, self.id, reason=reason, **payload)