Skip to content

Commit ce4069f

Browse files
fix: fix Invite model (#605)
* fix: fix Invite model missing attributes + adding docstring * ci: correct from checks. Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent fd5eea4 commit ce4069f

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

interactions/api/models/guild.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,11 +1574,17 @@ class Invite(DictSerializerMixin):
15741574
"""
15751575
The invite object.
15761576
1577-
:ivar int uses: The amount of uses on the invite.
1578-
:ivar int max_uses: The amount of maximum uses on the invite.
1579-
:ivar int max_age: The maximum age of this invite.
1580-
:ivar bool temporary: A detection of whether this invite is temporary or not.
1577+
:ivar int uses: The amount of uses on this invite.
1578+
:ivar int max_uses: The amount of maximum uses on this invite.
1579+
:ivar int max_age: The maximum age of this invite, in seconds.
1580+
:ivar bool temporary: A detection of whether this invite only grants temporary membership.
15811581
:ivar datetime created_at: The time when this invite was created.
1582+
:ivar datetime expires_at: The time when this invite will expire.
1583+
:ivar int type: The type of this invite.
1584+
:ivar User inviter: The user who created this invite.
1585+
:ivar int guild_id: The guild ID of this invite.
1586+
:ivar str code: The code of this invite.
1587+
:ivar int channel_id: The channel ID of this invite.
15821588
"""
15831589

15841590
__slots__ = (
@@ -1589,8 +1595,7 @@ class Invite(DictSerializerMixin):
15891595
"max_age",
15901596
"temporary",
15911597
"created_at",
1592-
# TODO: Investigate their purposes and document.
1593-
"types",
1598+
"type",
15941599
"inviter",
15951600
"guild_id",
15961601
"expires_at",
@@ -1605,6 +1610,14 @@ def __init__(self, **kwargs):
16051610
if self._json.get("created_at")
16061611
else None
16071612
)
1613+
self.expires_at = (
1614+
datetime.fromisoformat(self._json.get("expires_at"))
1615+
if self._json.get("expires_at")
1616+
else None
1617+
)
1618+
self.inviter = User(**self._json.get("inviter")) if self._json.get("inviter") else None
1619+
self.channel_id = int(self.channel_id)
1620+
self.guild_id = int(self.guild_id)
16081621

16091622

16101623
class GuildTemplate(DictSerializerMixin):

0 commit comments

Comments
 (0)