SoSad
Drop in. Scale up.
A modern, modular, type-safe Discord framework built on Hikari.
Change one line. Get production-ready features instantly.
Why SoSad?
For discord.py refugees
| Feature | discord.py | SoSad |
|---|---|---|
| Rate limiting | Manual retry | Automatic per-route |
| Error handling | try/except | Error pipeline |
| Dependency Injection | None | FastAPI-style container |
| Middleware | Before/After hooks | ASGI-style pipeline |
| Plugins | Manual load_extension |
Auto-discover |
| Config | os.getenv |
pydantic-style Settings |
| Type safety | Partial | Pyright strict |
| REST mode | ❌ | ✅ (no gateway needed) |
| Persistent Components | ❌ | ✅ (survive restarts) |
| Task scheduler | ❌ | ✅ (cron-like) |
| CLI scaffold | ❌ | ✅ (sosad new) |
For new projects
import hikari
import sosad
class Config(sosad.Settings):
token: str
bot = sosad.Client(token=Config().token, intents=hikari.Intents.ALL_UNPRIVILEGED)
@sosad.slash_command("ping", "Pong!")
async def ping(ctx: sosad.InteractionContext):
await ctx.respond("Pong!")
bot.run()
Quick install
Architecture
┌──────────────────────────────────────────────────┐
│ Your Code │
│ ┌──────────┐ ┌──────────┐ ┌────────────────┐ │
│ │ Commands │ │ Plugins │ │ Components │ │
│ └────┬─────┘ └────┬─────┘ └───────┬────────┘ │
├───────┴─────────────┴─────────────────┴──────────┤
│ SoSad Core │
│ ┌──────────┐ ┌──────────┐ ┌────────────────┐ │
│ │ Router │ │Middleware│ │ DI Container │ │
│ └────┬─────┘ └────┬─────┘ └───────┬────────┘ │
│ └─────────────┴─────────────────┘ │
│ ┌──────────────────────────────────────────────┐ │
│ │ Hikari (transport) │ │
│ └──────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────┘
Features
-
:material-speedometer:{ .lg .middle } Auto Rate Limiting
Per-route rate limiting. No more HTTP 429s. Works for both Gateway and REST mode.
-
:material-shield-lock:{ .lg .middle } Type Safe
Full type hints. Pyright strict mode. Catch errors before runtime.
-
:material-puzzle:{ .lg .middle } Modular Plugins
Drop files in
plugins/— auto-discovered and loaded. -
:material-cog:{ .lg .middle } DI + Middleware
FastAPI-style dependency injection. ASGI-inspired middleware pipeline.
-
:material-view-grid:{ .lg .middle } Components
Buttons, Select Menus, Modals, Persistent Views, Paginator.
-
:material-clock:{ .lg .middle } Background Tasks
Decorator-based task scheduler with intervals and CRON-like triggers.
-
:material-api:{ .lg .middle } REST Mode
Run without a gateway. Perfect for webhooks, microservices, and serverless.
-
:material-swap-horizontal:{ .lg .middle } discord.py Compat
Change one import. Keep your existing codebase.