mirror of
https://github.com/yawaflua/Flask-Discord.git
synced 2025-12-10 12:29:30 +02:00
Add user_id property
This commit is contained in:
@@ -53,8 +53,18 @@ class DiscordOAuth2HttpClient(abc.ABC):
|
|||||||
app.discord = self
|
app.discord = self
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def user_id(self):
|
def user_id(self) -> typing.Union[int, None]:
|
||||||
"""A property which returns Discord user ID if it exists in flask :py:attr:`flask.session` object."""
|
"""A property which returns Discord user ID if it exists in flask :py:attr:`flask.session` object.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
int
|
||||||
|
The Discord user ID of current user.
|
||||||
|
None
|
||||||
|
If the user ID doesn't exists in flask :py:attr:`flask.session`.
|
||||||
|
|
||||||
|
"""
|
||||||
|
return session.get("DISCORD_USER_ID")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _token_updater(token):
|
def _token_updater(token):
|
||||||
|
|||||||
Reference in New Issue
Block a user