dpixels
A(nother) wrapper for the Python Discord Pixel API.
Features
- Proper ratelimite handeling.
- Saves ratelimits in a json file, so restarting scripts won't trigger cooldowns.
- Supports all Pixel API endpoints.
- Supports autodrawing of images.
Examples
Get the canvas:
client = dpixels.Client(token="your token")
canvas = await client.get_canvas()
canvas = client.canvas
Get a specific pixel:
pixel = canvas[0, 0]
pixel = await client.get_pixel(0, 0)
pixel.hex
pixel.int
pixel.rgb
Setting a pixel:
await client.set_pixel(0, 0, dpixels.Color(255, 255, 255))
Autodrawing an image:
from PIL import Image
im = Image.open("path_to_image.ext")
source = dpixels.Source.from_image((0, 0), im)
await client.draw_sources([source])
Credits
This library is heavily based on Artemis21/dpypx