PythonistaGuild / Pythonista-Bot

Discord Bot for the Pythonista Guild.
MIT License
12 stars 7 forks source link

Initial Pythonista API Websocket implementation. #37

Closed EvieePy closed 1 year ago

EvieePy commented 1 year ago

This adds a websocket listener for the Pythonista API.

To run this you must provide a Pythonista API Application token in the config that has websocket permissions.

Currently the only event this websocket subscribes to is discord_py_mod_log. When that event is received, a bot event via bot.dispatch is dispatched: on_papi_dpy_modlog which takes in one parameter, the payload data received from the API, without the op/user_id fields.

In the event that the Pythonista API is disconnected for some reason this will try to connect with an Expotential Backoff, unless the token is refused.