A small library and command line app to automate Docker health checks for discord.py bots.
Project description
Discord Health Check
A small library and command line app to automate Docker health checks for discord.py bots.
How it works
The library has 1 function, start
. This takes a discord.Client
object as well as optional parameters. This function
creates a TCP socket server and when a client connects, it tests the discord client for various things that indicate
its health. The result of this health check is then sent to the client.
The CLI app is a simple client that connects to the server and determines its exit code from what the server sends.
Installation
pip install discordhealthcheck
This will install both the Python library and the command line app.
The default server port is 40404
.
Usage
Python Library
import discord
import discordhealthcheck
class ExampleClient(discord.Client):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
discordhealthcheck.start(self)
or
import discord
import discordhealthcheck
client = discord.Client()
discordhealthcheck.start(client)
@client.event
async def on_ready():
print("Logged in")
Command Line App (in Dockerfile)
FROM python:3.8-slim-buster
# Copy files, install requirements, setup bot, etc.
# Make sure `pip install discordhealthcheck` happens
HEALTHCHECK CMD discordhealthcheck || exit 1
CMD ["python","./path/to/bot/main.py"]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for discordhealthcheck-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6659e85735340f958b74940bb5b1a1b609324f962d85ab661f3176e89c40f7cb |
|
MD5 | 2b56f8573d1bc408762064cb3c1137e3 |
|
BLAKE2b-256 | 23c4cbde0a5e9118d7e237f4e919a05bda220c30d7fd6e04d71ceb3e62801454 |