Skip to content

Quick Start

Terminal window
pip install "cordless[deploy]"
Terminal window
mkdir my-bot && cd my-bot
cordless init my-bot

This 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.

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"
Terminal window
cordless dev

Runs 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.

Terminal window
export DISCORD_BOT_TOKEN=your_bot_token
cordless deploy --register lambda_function:bot

One 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.