Quick Start
Install
Section titled “Install”pip install "cordless[deploy]"Scaffold
Section titled “Scaffold”mkdir my-bot && cd my-botcordless init my-botThis creates lambda_function.py, cordless.toml, and .env.example.
lambda_function.py
import os
from cordless import Cordless
bot = Cordless(public_key=os.environ.get("DISCORD_PUBLIC_KEY"))
@bot.command("hello", description="Say hello")async def hello(ctx, name: str = "world"): await ctx.send(f"Hello, {name}!")
handler = bot.handler()Typed parameters become Discord options automatically — name: str = "world" registers an optional string option.
Configure
Section titled “Configure”Fill in your public key (Discord Developer Portal → General Information):
cordless.toml
[deploy]function = "my-bot"bot = "lambda_function:bot"region = "eu-west-2"
[deploy.env]DISCORD_PUBLIC_KEY = "your_public_key"Test locally
Section titled “Test locally”cordless devRuns your bot on localhost with hot reload. With cloudflared installed it also opens a public tunnel — paste that URL into your app’s Interactions Endpoint URL and test in Discord without deploying anything. Deferred handlers run in-process, so the whole flow works.
Deploy
Section titled “Deploy”export DISCORD_BOT_TOKEN=your_bot_tokencordless deploy --register lambda_function:botOne command: cordless creates the Lambda, API Gateway, and IAM role, registers your slash commands with Discord, and prints your bot’s URL. Paste it into your Discord app’s Interactions Endpoint URL and run /hello.
You can also register separately with cordless register lambda_function:bot — add --guild-id during development for instant propagation.
