Moving from Discord
Coming from Discord
What carries over from Discord's API, what differs, and what bots can't do in Lamma.
Lamma keeps its own API, tokens and payloads, so a Discord token, gateway address or raw payload won't work as it is. The shapes and names are close on purpose, though, and the SDKs keep most bot code the same.
For step-by-step guides with every code change, see Migrate from discord.js and Migrate from discord.py.
#Switch in two lines
With the SDKs, most bots change only the import and the token (LAMMA_TOKEN). Lamma's address is built in, so the rest of the code stays as it is.
Text
- import { Client, GatewayIntentBits } from 'discord.js';
+ import { Client, GatewayIntentBits } from 'lamma.js';Text
- import discord
- from discord.ext import commands
+ import lamma as discord
+ from lamma.ext import commands#What carries over
| Discord | Lamma |
|---|---|
| Application and bot user | Application and bot account, one bot per app |
Authorization: Bot <token> | The same header, with an lmb1_ token that works only on /v1 |
| OAuth2 install link | https://lammapp.sa/app?app=<id>, which opens Lamma's install screen. There is no OAuth2 redirect flow yet |
| Gateway hello, identify, heartbeat and dispatch | The same steps, with named ops instead of numbers |
| Intents bitfield | The SDKs take Discord's intents. On the raw gateway, identify takes names, such as guild_messages. message_content and guild_members are privileged, as on Discord |
| Event names | The same: MESSAGE_CREATE, GUILD_MEMBER_ADD, INTERACTION_CREATE, … |
| Message, reaction, server, member and audit log paths | The same paths under /v1 |
| Embeds | The same fields and limits. No images, thumbnails or video yet |
Mentions and allowed_mentions | The same |
Message nonce | The same, and it really prevents double posts |
Audit log action_type | Discord's numbers |
| Slash command JSON and bulk overwrite | The same. Option types 3 to 8 and 10 |
| Interaction callback types 4 and 5, edit original, follow-ups, ephemeral flag 64 | The same, using the bot token instead of an interaction token |
| Execute Webhook | The same body for text and embeds |
#What's different
| Discord | Lamma |
|---|---|
| Permission bitfields | The SDKs give Discord's bitfields. The raw API sends permission names, such as send_messages |
Channel type number | The SDKs give Discord's type. The raw API sends kind, such as text |
retry_after in seconds | Milliseconds on /v1 (seconds on webhooks, as on Discord) |
| Gateway resume | Not yet: reconnect and catch up over REST |
| Sharding | Not needed: one connection per bot |
| Global commands take up to an hour | Global commands appear at once |
default_member_permissions | Not enforced yet: check permissions in your code |
#Not offered to bots
| Discord feature | Lamma |
|---|---|
| Direct messages, presence and typing | Never offered to bots, for privacy. The SDKs behave as if every person had DMs closed |
| Kicking, banning, timing out and deleting other people's messages | Not in v1. Bots can still hear about them |
| Buttons, select menus, modals, autocomplete and subcommands | Later |
| Voice bots | Not planned for v1 |
| Threads, forums, stages and stickers | Lamma doesn't have them yet |
| Outgoing webhooks | Later |