Skip to main content

cordless

PyPI Tests License Python versions

Build a production Discord bot without running a bot server. Discord sends a request, AWS Lambda wakes up, your handler runs, and it goes back to sleep. No process to keep alive, no idle cost.

import os
from cordless import Cordless

bot = Cordless(public_key=os.environ["DISCORD_PUBLIC_KEY"])

@bot.command("ping", description="Say hello")
async def ping(ctx):
    await ctx.send("pong")

handler = bot.handler()
cordless deploy --register
# → https://abc123.lambda-url.us-east-1.on.aws/

Why cordless?

Most Discord bots run as long-lived processes, a VPS or container that sits idle 99% of the time, waiting for someone to type a command. You pay for uptime whether your bot is busy or not.

cordless flips this. Your bot is a Lambda function: it only runs when Discord sends an interaction, takes milliseconds to respond, and costs essentially nothing to host. One command provisions everything on AWS: IAM role, Lambda function, public endpoint (a direct Function URL by default, or API Gateway if you want a custom domain) and registers your commands with Discord.

  • No server: no EC2, no containers, no uptime monitoring, no SSH
  • No idle cost: Lambda charges per invocation, not per hour
  • One command to ship: cordless deploy handles all the AWS wiring
  • Local dev: cordless dev runs your bot on localhost with a live public tunnel
  • Slow commands: deferred interactions hand off to a worker Lambda so Discord's 3-second limit is never a problem
  • Full REST API: every Discord endpoint, typed, reachable as bot.<verb>() or directly on the objects you already have (guild.create_channel(), message.reply())
  • Raw HTTP routes: @bot.route("POST", "/stripe/webhook") handles third-party webhooks, OAuth callbacks and health checks on the same function, outside Discord's interaction flow

Install

uv add cordless   # (we should ALL be using uv)

Quickstart

Scaffold a new bot:

mkdir my-bot && cd my-bot
cordless init my-bot

This creates lambda_function.py, cordless.toml, and .env.example.

Configure your credentials in .env:

DISCORD_PUBLIC_KEY=your_public_key
DISCORD_BOT_TOKEN=your_bot_token

Test locally: cordless dev runs your bot with hot reload. With cloudflared installed it opens a public tunnel so Discord can reach it directly.

cordless dev

Deploy to AWS and register your commands with Discord:

cordless deploy --register
# → https://abc123.lambda-url.us-east-1.on.aws/

Paste the URL into your Discord app's Interactions Endpoint URL and your bot is live.


Documentation

Full docs at cordless.dev: commands, options, buttons, modals, deferred interactions, Components v2, scheduled handlers, the REST API, and the full deploy reference.

Please note that this is a work in progress, I have found genuine interest in serverless development and wanted an easy way to provision AWS.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cordless-1.5.0.tar.gz (212.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cordless-1.5.0-py3-none-any.whl (142.2 kB view details)

Uploaded Python 3

File details

Details for the file cordless-1.5.0.tar.gz.

File metadata

  • Download URL: cordless-1.5.0.tar.gz
  • Upload date:
  • Size: 212.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cordless-1.5.0.tar.gz
Algorithm Hash digest
SHA256 8da29c4db7199c13630ff08a5c2e1c7d9f5913db04e54f926e7aef4beea56b38
MD5 8b70eccce6facad465277dabbc0f2ad4
BLAKE2b-256 40acfa766515b8e0f514061d525b8ed8bf580e428a4220db10e22b7676559a2a

See more details on using hashes here.

File details

Details for the file cordless-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: cordless-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 142.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cordless-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f605ca44e500e1a4b93eb7eb83a96e432fbe6eb6fb462b3ca0af6bbf4f4d47e8
MD5 41288b20c0b8a473883078233dc4128a
BLAKE2b-256 1732d3352fd7497e934febb147f2a20d8bab2d9c5465368c01e67a2bc714eb26

See more details on using hashes here.

Release history Release notifications | RSS feed

1.5.1

2 files

This release

1.5.0 This release

2 files

1.4.7

2 files

1.4.6

2 files

1.4.5

2 files

1.4.4

2 files

1.4.3

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.0

2 files

1.2.0

2 files

1.1.3

2 files

1.1.2

2 files

1.1.0

2 files

1.0.0

2 files

0.13.2

2 files

0.13.1

2 files

0.13.0

2 files

0.12.1

2 files

0.12.0

2 files

0.11.0

2 files

0.10.7

2 files

0.10.6

2 files

0.10.5

2 files

0.10.4

2 files

0.10.3

2 files

0.10.2

2 files

0.10.0

2 files

0.9.0

2 files

0.8.3

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.3

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page