-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added new post functions and changable presences
- Loading branch information
1 parent
8ce20e9
commit 644a54a
Showing
7 changed files
with
142 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
test.py | ||
test.png | ||
*.pyc | ||
.vscode/settings.json |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import nerimity | ||
from nerimity._enums import GlobalClientInformation | ||
from nerimity._enums import ConsoleShortcuts | ||
import requests | ||
import json | ||
|
||
class Status(): | ||
""" | ||
Represents the status of the user. | ||
status: The current status of the user. | ||
activity: The current activity of the user. | ||
""" | ||
|
||
def __init__(self, status: str, activity: str): | ||
self.status: str = status | ||
self.activity: str = activity | ||
|
||
class StatusType(): | ||
""" | ||
Represents the status type of the user. | ||
online: The user is online. | ||
looking: The user is idle. | ||
idle : The user is idle. | ||
dnd: The user is in Do Not Disturb mode. | ||
offline: The user is invisible. | ||
""" | ||
type = int | ||
online = 1 | ||
looking_to_play = 2 | ||
idle = 3 | ||
dnd = 4 | ||
offline = 5 | ||
|
||
# Public: Changes the status of the user. | ||
@staticmethod | ||
def change_presence(status: StatusType = None, text: str = None) -> None: | ||
"""Changes the status of the user.""" | ||
api_endpoint = f"https://nerimity.com/api/users/presence" | ||
headers = { | ||
"Authorization": GlobalClientInformation.TOKEN, | ||
"Content-Type": "application/json", | ||
} | ||
data = { | ||
} | ||
if status: | ||
data["status"] = status | ||
if text: | ||
data["custom"] = text | ||
|
||
response = requests.post(api_endpoint, headers=headers, data=json.dumps(data)) | ||
if response.status_code != 200: | ||
print(f"{ConsoleShortcuts.error()} Failed to change presence. Status code: {response.status_code}. Response Text: {response.text}") | ||
raise requests.RequestException | ||
|
||
|
||
|