work / discord-cpv2
Discord Components V2 Reference
Every Discord Components V2 type in one runnable file: a reference you copy from instead of reading docs.
When Discord Components V2 shipped, the docs alone did not make it clear how the pieces fit together. This is one file that builds a message with every component type, so you copy the shape you need instead of going back and forth between docs and code.
How it works
One cpv2.py, written in March 2026. It uses discord.py for the gateway and slash commands, but sends the Components V2 payload as raw JSON over bot.http.request rather than through discord.py’s own component classes, so it does not depend on the library’s V2 support. Each example runs as-is when pasted.
Covered: Action Row, Button in all five styles, the String / User / Role / Mentionable / Channel selects, Section with a Thumbnail or a Button accessory, Text Display, Thumbnail, Media Gallery, File, Separator, and Container with accent colour and spoiler. A single message caps at 40 components.