Skip to content

Quick Start

Create a project

sosad new mybot
cd mybot
uv sync

The CLI scaffolds a complete project structure:

mybot/
├── bot.py              # Entry point
├── .env                # Environment variables
├── .gitignore
├── pyproject.toml
├── plugins/
│   └── example.py      # Example plugin
└── .sosad/             # Framework config

Add your token

Edit .env:

TOKEN=your-discord-bot-token

Run

uv run bot.py

Manual setup (without CLI)

# bot.py
import hikari
import sosad

@sosad.slash_command("ping", "Check bot latency")
async def ping(ctx: sosad.InteractionContext) -> None:
    await ctx.respond("Pong!")

if __name__ == "__main__":
    bot = sosad.Client(
        token="YOUR_TOKEN_HERE",
        intents=hikari.Intents.ALL_UNPRIVILEGED,
    )
    bot.run()

Using discord.py compat

import sosad.compat as discord
import hikari

bot = discord.Bot(
    command_prefix="!",
    intents=hikari.Intents.ALL_UNPRIVILEGED,
    token="YOUR_TOKEN_HERE",
)

@bot.prefix_command(name="ping")
async def ping(ctx):
    await ctx.send("Pong!")

bot.run()

Next

  • Commands — slash commands, subcommands, groups
  • Context — responding, deferring, editing
  • Components — buttons, selects, modals