- Python - nakidai/petthecord
- Go - wavy-cat/petpet-go
To get started with this api, follow these instructions:
- Rust: Ensure you have Rust installed. If not, you can install it from the official site.
- Cargo: Comes with Rust, and you'll use it to build and run the server.
-
Clone the Repository
git clone https://github.com/messengernew/petpet-api.git cd petpet-api
-
Set Up Environment
Create a
.env
file in the root of the project directory with the following optional configurations:BIND_IP=0.0.0.0 BIND_PORT=6969
BIND_IP
: IP address for the server to bind to (default is0.0.0.0
).BIND_PORT
: Port for the server to listen on (default is6969
).
-
Build and Run
cargo build --release cargo run --release
-
Image Request: Fetch and process images with the following endpoint:
GET /pat/{id}?mode={mode}&upd={force_update}&speed={speed}
id
: The discord user ID to fetch his avatar (must be a number).mode
: Response format. Can begif
,base64
, orjson
. Defaults togif
.force_update
: Iftrue
, forces the server to reprocess the image. Defaults tofalse
.speed
: Filter type for the GIF. Can beno
for slower quality (Catmull-Rom) or anything else for faster quality (Nearest Neighbor).
Example:
curl "http://localhost:6969/123?mode=json&speed=no"
-
JSON Response
{ "id": "123", "image_data": "base64encodeddata..." }
-
Base64 Response
base64encodeddata...
-
GIF Response
The raw GIF data.
This project is licensed under the GPL-3.0 License - see the LICENSE file for details.