Last active
April 2, 2021 00:25
-
-
Save an0ndev/c173c590565a9153a640c7a5e63991b9 to your computer and use it in GitHub Desktop.
Change the status of a userbot with discord.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async def userbot_change_status (client, *, text, emoji = None): | |
| """|coro| | |
| Changes a userbot's status. | |
| Example | |
| --------- | |
| .. code-block:: python3 | |
| client = discord.Client ("token", bot = False) # shh... | |
| await userbot_change_status (client, text = "ToS is gone", emoji = "🥳") | |
| Parameters | |
| ---------- | |
| client: :class:`.Client` | |
| The client representing the userbot to change the status of. | |
| text: :class:`str` | |
| The text of the status. | |
| emoji: Optional[:class:`str`] | |
| The emoji displayed before the status. | |
| If ``None``, no emoji is displayed. | |
| """ | |
| route = discord.http.Route ("PATCH", "/users/{user_id}/settings", user_id = "@me") | |
| payload = {"custom_status": {"text": text}} | |
| if emoji is not None: payload ["custom_status"] ["emoji_name"] = emoji | |
| await client.http.request (route, reason = None, json = payload) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Rapptz might be useful? not sure