commit 19ad2840b8d98f0d19b0b8e6fd5e820aa6bfe295 Author: KoffeeJava Date: Thu Jan 29 19:41:22 2026 -0700 Inital Commit! diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7773828 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +dist/ \ No newline at end of file diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..89bdf55 --- /dev/null +++ b/LICENCE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 KoffeeJava + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..1a1966e --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# NEW FUNC +`macaronipm.user.UserExist()` + +`macaronipm.user.IsBanned()` + +`macaronipm.user.logout()` + +`macaronipm.user.GetMessages()` + +`macaronipm.user.getUnreadMessages()` + +`macaronipm.IsOnline()` + +`macaronipm.project.hasLovedVoted()` \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c258fb9 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,22 @@ +[build-system] +requires = ["uv_build >= 0.9.26, <0.10.0"] +build-backend = "uv_build" + +[project] +name = "macaronipm" +version = "3.0.0" +authors = [ + { name="KoffeeJava", email="koffeejava@tuta.io" }, +] +description = "A PenguinMod API Wrapper" +readme = "README.md" +requires-python = ">=3.9" +classifiers = [ + "Programming Language :: Python :: 3", + "Operating System :: OS Independent", +] +license = "MIT" +license-files = ["LICEN[CS]E*"] + +[project.urls] +Homepage = "https://www.koffeejava.us/macaroni" \ No newline at end of file diff --git a/src/macaronipm/__init__.py b/src/macaronipm/__init__.py new file mode 100644 index 0000000..6039daf --- /dev/null +++ b/src/macaronipm/__init__.py @@ -0,0 +1,14 @@ +import requests +from . import misc +from . import project +from . import user + +def isOnline(): + url = f"https://projects.penguinmod.com/api/v1/ping" + + response = requests.get(url) + + if not response.status_code == 200: + return -1 + + return 0 \ No newline at end of file diff --git a/src/macaronipm/__pycache__/__init__.cpython-314.pyc b/src/macaronipm/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000..55c48fb Binary files /dev/null and b/src/macaronipm/__pycache__/__init__.cpython-314.pyc differ diff --git a/src/macaronipm/__pycache__/main.cpython-314.pyc b/src/macaronipm/__pycache__/main.cpython-314.pyc new file mode 100644 index 0000000..311a50d Binary files /dev/null and b/src/macaronipm/__pycache__/main.cpython-314.pyc differ diff --git a/src/macaronipm/__pycache__/misc.cpython-314.pyc b/src/macaronipm/__pycache__/misc.cpython-314.pyc new file mode 100644 index 0000000..31e74f7 Binary files /dev/null and b/src/macaronipm/__pycache__/misc.cpython-314.pyc differ diff --git a/src/macaronipm/__pycache__/project.cpython-314.pyc b/src/macaronipm/__pycache__/project.cpython-314.pyc new file mode 100644 index 0000000..6e2f425 Binary files /dev/null and b/src/macaronipm/__pycache__/project.cpython-314.pyc differ diff --git a/src/macaronipm/__pycache__/user.cpython-314.pyc b/src/macaronipm/__pycache__/user.cpython-314.pyc new file mode 100644 index 0000000..6b17a78 Binary files /dev/null and b/src/macaronipm/__pycache__/user.cpython-314.pyc differ diff --git a/src/macaronipm/misc.py b/src/macaronipm/misc.py new file mode 100644 index 0000000..b1afbf3 --- /dev/null +++ b/src/macaronipm/misc.py @@ -0,0 +1,45 @@ +import requests +import json +from colorist import Color +from colorist import Effect +from colorist import ColorHex + +ORANGE = ColorHex("#ff8800") + +def setToken(settoken): + global TOKEN + TOKEN = settoken + +def setProject(projectid): + global PID + PID = projectid + +def follow(target, toggle): + url = "https://projects.penguinmod.com/api/v1/users/follow" + + data = f'{{"token":"{TOKEN}","target":"{target}","toggle":{toggle}}}' + headers = {'Content-type': 'application/json'} + response = requests.post(url, headers=headers, data=data) + + + if not response.status_code == 200: + print(f"MacaroniPM: {Color.RED}Something went wrong!") + print(f"Status code: {response.status_code}") + print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{json.loads(response.content.decode())["error"]}{Effect.OFF}") + return -1 + + return 0 + +def GetFeatured(): + print(f"{ORANGE}MacaroniPM: The featured function is stil being worked on. It is recomended {Effect.BOLD}{Effect.UNDERLINE}NOT{Effect.OFF}{ORANGE} to use this.{Effect.OFF}") + url = f"https://projects.penguinmod.com/api/v1/projects/searchprojects?page=0&query=&type=featured&token={TOKEN}&reverse=false" + + response = requests.get(url) + + if not response.status_code == 200: + print(f"{Color.RED}Something went wrong!") + print(f"Status code: {response.status_code}") + print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{json.loads(response.content.decode())["error"]}{Effect.OFF}") + return -1 + + return response.text.split() \ No newline at end of file diff --git a/src/macaronipm/project.py b/src/macaronipm/project.py new file mode 100644 index 0000000..49cddf1 --- /dev/null +++ b/src/macaronipm/project.py @@ -0,0 +1,91 @@ +from . import misc +import io +import requests +import json +import base64 +from colorist import Color +from colorist import Effect + +def getThumbnail(): + url = f"https://projects.penguinmod.com/api/v1/projects/getproject?projectID={misc.PID}&requestType=thumbnail" + + response = requests.get(url) + + if not response.status_code == 200: + print(f"{Color.RED}Something went wrong!") + print(f"Status code: {response.status_code}") + print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{json.loads(response.content.decode())["error"]}{Effect.OFF}") + return -1 + + base64_data = base64.b64encode(io.BytesIO(response.content).read()).decode('utf-8') + return f"data:image/jpeg;base64,{base64_data}" + +def getMeta(): + url = f"https://projects.penguinmod.com/api/v1/projects/getproject?projectID={misc.PID}&requestType=metadata" + + response = requests.get(url) + + if not response.status_code == 200: + print(f"{Color.RED}Something went wrong!") + print(f"Status code: {response.status_code}") + print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{json.loads(response.content.decode())["error"]}{Effect.OFF}") + return -1 + + return json.loads(response.content) + +def loveToggle(toggle): + url = "https://projects.penguinmod.com/api/v1/projects/interactions/loveToggle" + + data = f'{{"projectId":"{misc.PID}","token":"{misc.TOKEN}","toggle":{toggle}}}' + headers = {'Content-type': 'application/json'} + response = requests.post(url, headers=headers, data=data) + + if not response.status_code == 200: + print(f"{Color.RED}Something went wrong!") + print(f"Status code: {response.status_code}") + print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{json.loads(response.content.decode())["error"]}{Effect.OFF}") + return -1 + + return 0 + +def voteToggle(toggle): + url = "https://projects.penguinmod.com/api/v1/projects/interactions/voteToggle" + + data = f'{{"projectId":"{misc.PID}","token":"{misc.TOKEN}","toggle":{toggle}}}' + headers = {'Content-type': 'application/json'} + response = requests.post(url, headers=headers, data=data) + + + if not response.status_code == 200: + print(f"{Color.RED}Something went wrong!") + print(f"Status code: {response.status_code}") + print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{json.loads(response.content.decode())["error"]}{Effect.OFF}") + return -1 + + return 0 + +def getRankedProjects(page): + url = f"https://projects.penguinmod.com/api/v1/projects/getprojects?page={page}" + + response = requests.get(url) + + if not response.status_code == 200: + print(f"{Color.RED}Something went wrong!") + print(f"Status code: {response.status_code}") + print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{json.loads(response.content.decode())["error"]}{Effect.OFF}") + return -1 + + return json.loads(response.content) + +def hasLovedVoted(): + url = f"https://projects.penguinmod.com/api/v1/projects/getuserstatewrapper?projectId={misc.PID}&token={misc.TOKEN}" + + response = requests.get(url) + + if not response.status_code == 200: + print(f"{Color.RED}Something went wrong!") + print(f"Status code: {response.status_code}") + print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{json.loads(response.content.decode())["error"]}{Effect.OFF}") + return -1 + + return json.loads(response.content) diff --git a/src/macaronipm/user.py b/src/macaronipm/user.py new file mode 100644 index 0000000..a631298 --- /dev/null +++ b/src/macaronipm/user.py @@ -0,0 +1,120 @@ +from . import misc +import io +import requests +import json +import base64 +from colorist import Color +from colorist import Effect + +def getMeta(target): + url = f"https://projects.penguinmod.com/api/v1/users/profile?target={target}&token={misc.misc.TOKEN}" + + response = requests.get(url) + + if not response.status_code == 200: + print(f"{Color.RED}Something went wrong!") + print(f"Status code: {response.status_code}") + print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{json.loads(response.content.decode())["error"]}{Effect.OFF}") + return -1 + + return json.loads(response.content) + +def isBlocking(target): + url = f"https://projects.penguinmod.com/api/v1/users/hasblocked?target={target}&token={misc.misc.TOKEN}" + + response = requests.get(url) + + if not response.status_code == 200: + print(f"{Color.RED}Something went wrong!") + print(f"Status code: {response.status_code}") + print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{json.loads(response.content.decode())["error"]}{Effect.OFF}") + return -1 + + jsons = json.loads(response.content.decode()) + return jsons['has_blocked'] + +def getPfp(target): + url = f"https://projects.penguinmod.com/api/v1/users/getpfp?username={target}" + + response = requests.get(url) + + if not response.status_code == 200: + print(f"{Color.RED}Something went wrong!") + print(f"Status code: {response.status_code}") + print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{json.loads(response.content.decode())["error"]}{Effect.OFF}") + return -1 + + base64_data = base64.b64encode(io.BytesIO(response.content).read()).decode('utf-8') + return f"data:image/jpeg;base64,{base64_data}" + +def userExist(target): + url = f"https://projects.penguinmod.com/api/v1/users/userexists?username={target}" + + response = requests.get(url) + + if not response.status_code == 200: + print(f"{Color.RED}Something went wrong!") + print(f"Status code: {response.status_code}") + print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{json.loads(response.content.decode())["error"]}{Effect.OFF}") + return -1 + + + return json.loads(response.content)['exists'] + +def isBanned(target): + url = f"https://projects.penguinmod.com/api/v1/users/isBanned?username={target}" + + response = requests.get(url) + + if not response.status_code == 200: + print(f"{Color.RED}Something went wrong!") + print(f"Status code: {response.status_code}") + print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{json.loads(response.content.decode())["error"]}{Effect.OFF}") + return -1 + + + return json.loads(response.content)['isBanned'] + +def logout(): + url = "https://projects.penguinmod.com/api/v1/users/logout" + + data = f'{{"token":"{misc.misc.TOKEN}"}}' + headers = {'Content-type': 'application/json'} + response = requests.post(url, headers=headers, data=data) + + + if not response.status_code == 200: + print(f"{Color.RED}Something went wrong!") + print(f"Status code: {response.status_code}") + print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{json.loads(response.content.decode())["error"]}{Effect.OFF}") + return -1 + + return 0 + +def getMessages(): + url = f"https://projects.penguinmod.com/api/v1/users/getmessages?token={misc.TOKEN}" + + response = requests.get(url) + + if not response.status_code == 200: + print(f"{Color.RED}Something went wrong!") + print(f"Status code: {response.status_code}") + print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{json.loads(response.content.decode())["error"]}{Effect.OFF}") + return -1 + + jsons = json.loads(response.content.decode()) + return jsons + +def getUnreadMessages(): + url = f"https://projects.penguinmod.com/api/v1/users/getunreadmessages?token={misc.TOKEN}" + + response = requests.get(url) + + if not response.status_code == 200: + print(f"{Color.RED}Something went wrong!") + print(f"Status code: {response.status_code}") + print(f"Response from url: {Effect.BOLD}{Effect.UNDERLINE}{json.loads(response.content.decode())["error"]}{Effect.OFF}") + return -1 + + jsons = json.loads(response.content.decode()) + return jsons \ No newline at end of file diff --git a/src/test.py b/src/test.py new file mode 100644 index 0000000..89e0d43 --- /dev/null +++ b/src/test.py @@ -0,0 +1,6 @@ +import macaronipm + +macaronipm.misc.setToken("6e5035471364acbbdb523dd05e903ccd48c3a60ea6d5ec14c485a833dccf555f") +macaronipm.misc.setProject("5284710295") + +print(macaronipm.user.getUnreadMessages()) \ No newline at end of file