aboutsummaryrefslogtreecommitdiff
path: root/discord/invite.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/invite.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/invite.py')
-rw-r--r--discord/invite.py40
1 files changed, 29 insertions, 11 deletions
diff --git a/discord/invite.py b/discord/invite.py
index 697c62d0..3c061750 100644
--- a/discord/invite.py
+++ b/discord/invite.py
@@ -34,6 +34,7 @@ __all__ = (
'Invite',
)
+
class PartialInviteChannel:
"""Represents a "partial" invite channel.
@@ -79,7 +80,7 @@ class PartialInviteChannel:
return self.name
def __repr__(self):
- return '<PartialInviteChannel id={0.id} name={0.name} type={0.type!r}>'.format(self)
+ return f'<PartialInviteChannel id={self.id} name={self.name} type={self.type!r}>'
@property
def mention(self):
@@ -91,6 +92,7 @@ class PartialInviteChannel:
""":class:`datetime.datetime`: Returns the channel's creation time in UTC."""
return snowflake_time(self.id)
+
class PartialInviteGuild:
"""Represents a "partial" invite guild.
@@ -135,8 +137,7 @@ class PartialInviteGuild:
The partial guild's description.
"""
- __slots__ = ('_state', 'features', 'icon', 'banner', 'id', 'name', 'splash',
- 'verification_level', 'description')
+ __slots__ = ('_state', 'features', 'icon', 'banner', 'id', 'name', 'splash', 'verification_level', 'description')
def __init__(self, state, data, id):
self._state = state
@@ -153,8 +154,10 @@ class PartialInviteGuild:
return self.name
def __repr__(self):
- return '<{0.__class__.__name__} id={0.id} name={0.name!r} features={0.features} ' \
- 'description={0.description!r}>'.format(self)
+ return (
+ f'<{self.__class__.__name__} id={self.id} name={self.name!r} features={self.features} '
+ f'description={self.description!r}>'
+ )
@property
def created_at(self):
@@ -213,6 +216,7 @@ class PartialInviteGuild:
"""
return Asset._from_guild_image(self._state, self.id, self.splash, 'splashes', format=format, size=size)
+
class Invite(Hashable):
r"""Represents a Discord :class:`Guild` or :class:`abc.GuildChannel` invite.
@@ -291,9 +295,21 @@ class Invite(Hashable):
The channel the invite is for.
"""
- __slots__ = ('max_age', 'code', 'guild', 'revoked', 'created_at', 'uses',
- 'temporary', 'max_uses', 'inviter', 'channel', '_state',
- 'approximate_member_count', 'approximate_presence_count' )
+ __slots__ = (
+ 'max_age',
+ 'code',
+ 'guild',
+ 'revoked',
+ 'created_at',
+ 'uses',
+ 'temporary',
+ 'max_uses',
+ 'inviter',
+ 'channel',
+ '_state',
+ 'approximate_member_count',
+ 'approximate_presence_count',
+ )
BASE = 'https://discord.gg'
@@ -361,9 +377,11 @@ class Invite(Hashable):
return self.url
def __repr__(self):
- return '<Invite code={0.code!r} guild={0.guild!r} ' \
- 'online={0.approximate_presence_count} ' \
- 'members={0.approximate_member_count}>'.format(self)
+ return (
+ f'<Invite code={self.code!r} guild={self.guild!r} '
+ f'online={self.approximate_presence_count} '
+ f'members={self.approximate_member_count}>'
+ )
def __hash__(self):
return hash(self.code)