mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-10 15:59:50 +00:00
Add Client.status attribute
This commit is contained in:
parent
efec816de2
commit
2f2c39ed22
@ -687,6 +687,26 @@ class Client:
|
|||||||
self._connection._activity = value.to_dict() # type: ignore
|
self._connection._activity = value.to_dict() # type: ignore
|
||||||
else:
|
else:
|
||||||
raise TypeError('activity must derive from BaseActivity.')
|
raise TypeError('activity must derive from BaseActivity.')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def status(self):
|
||||||
|
""":class:`.Status`:
|
||||||
|
The status being used upon logging on to Discord.
|
||||||
|
|
||||||
|
.. versionadded: 2.0
|
||||||
|
"""
|
||||||
|
if self._connection._status in set(state.value for state in Status):
|
||||||
|
return Status(self._connection._status)
|
||||||
|
return Status.online
|
||||||
|
|
||||||
|
@status.setter
|
||||||
|
def status(self, value):
|
||||||
|
if value is Status.offline:
|
||||||
|
self._connection._status = 'invisible'
|
||||||
|
elif isinstance(value, Status):
|
||||||
|
self._connection._status = str(value)
|
||||||
|
else:
|
||||||
|
raise TypeError('status must derive from Status.')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def allowed_mentions(self) -> Optional[AllowedMentions]:
|
def allowed_mentions(self) -> Optional[AllowedMentions]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user