fix(invite): guard against None code - #3313
Conversation
|
Thanks for opening this pull request! This pull request can be checked-out with: git fetch origin pull/3313/head:pr-3313
git checkout pr-3313This pull request can be installed with: pip install git+https://github.com/Pycord-Development/pycord@refs/pull/3313/head |
Signed-off-by: Michael <vmphase.dev@gmail.com>
Paillat-dev
left a comment
There was a problem hiding this comment.
What are the specific cases where code is missing ?
Can't recall for now but it potentially could be, because it returns a partial invite object. |
Signed-off-by: Michael <vmphase.dev@gmail.com>
This comment was marked as duplicate.
This comment was marked as duplicate.
Paillat-dev
left a comment
There was a problem hiding this comment.
Returns a partial invite object for guilds with that feature enabled. Requires the MANAGE_GUILD permission. code will be null if a vanity url for the guild is not set.
While technically code can be null, that is to signify a vanity invite is not set. So I am confused as to why we would create an Invite object for it in the first place. Guarding for that if it even is the case is a better fix imo
Summary
Invite.__init__acceptsVanityInviteas a type, butVanityInvite.codeis optional.Hence, if
codeisNone,Invite.urlinterpolates it (str(None)yieldsNone) resultinghttps://discord.gg/None.Information
examples, ...).
Checklist
type: ignorecomments were used, a comment is also left explaining why.