Python SDK for Commandless relay API
Project description
commandless-relay (Python)
Official Python SDK for the Commandless relay API.
This package gives Python bots a simple client and a ready-to-use discord.py adapter.
Install
Core client:
pip install commandless-relay
With discord.py adapter support:
pip install "commandless-relay[discord]"
Quickstart (discord.py)
import os
import discord
from commandless_relay import RelayClient, use_discord_adapter
TOKEN = os.getenv("BOT_TOKEN")
API_KEY = os.getenv("COMMANDLESS_API_KEY")
BASE_URL = os.getenv("COMMANDLESS_SERVICE_URL")
intents = discord.Intents.default()
intents.message_content = True
intents.messages = True
intents.guilds = True
client = discord.Client(intents=intents)
relay = RelayClient(api_key=API_KEY, base_url=BASE_URL)
use_discord_adapter(client, relay, mention_required=True)
@client.event
async def on_ready():
print(f"Logged in as {client.user}")
client.run(TOKEN)
Environment variables
BOT_TOKEN- your Discord bot tokenCOMMANDLESS_API_KEY- API key created in Commandless dashboardCOMMANDLESS_SERVICE_URL- your Commandless backend URLCOMMANDLESS_HMAC_SECRET- optional HMAC secret
Included components
RelayClientsend_event(event)-> Decision dict orNoneregister_bot(...)-> botId (optional flow)heartbeat()(optional flow)
use_discord_adapter(client, relay, mention_required=True, execute=None)- binds an
on_messagelistener - sends events to relay
- executes reply actions by default
- sends a clear message on billing rejection (402 / no subscription or credits)
- binds an
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file commandless_relay-0.1.0.tar.gz.
File metadata
- Download URL: commandless_relay-0.1.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9ba93c73b8173b5726668db31de0bdeb3b02860180debf9213d86da5b24be07
|
|
| MD5 |
8e5b27644582d67f3c2d46b05f3f7f6b
|
|
| BLAKE2b-256 |
6f0117e352bc96b907027eed84d42532b717982a70c619d42e4d5d55f2a0648d
|
File details
Details for the file commandless_relay-0.1.0-py3-none-any.whl.
File metadata
- Download URL: commandless_relay-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fa6051a87ede5371f1bbe8de9087b9fb3fd069e4835a3eef36321ce52f35c1d
|
|
| MD5 |
ca5fe3c97ee715087329b11455507538
|
|
| BLAKE2b-256 |
09224be528b4db33647fb6b8e89f27315f5d20e90ed4b0927efb3fcd7f178935
|