Skip to main content

A(nother) wrapper for the Python Discord Pixels API.

Project description

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()

# this also caches the canvas, so later you can do:
canvas = client.canvas

Get a specific pixel:

pixel = canvas[0, 0]  # get the pixel at 0,0
pixel = await client.get_pixel(0, 0)  # fetch the pixel at 0, 0

pixel.hex  # the hex value
pixel.int  # the int value
pixel.rgb  # the rgb value

Setting a pixel:

await client.set_pixel(0, 0, dpixels.Color(255, 255, 255))  # set the pixel at 0,0 to white

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])  # draw the source

Credits

This library is heavily based on Artemis21/dpypx

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dpixels-0.3.1.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

dpixels-0.3.1-py3-none-any.whl (8.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page