LammaDevelopers Open Lamma

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

DiscordLamma
Application and bot userApplication and bot account, one bot per app
Authorization: Bot <token>The same header, with an lmb1_ token that works only on /v1
OAuth2 install linkhttps://lammapp.sa/app?app=<id>, which opens Lamma's install screen. There is no OAuth2 redirect flow yet
Gateway hello, identify, heartbeat and dispatchThe same steps, with named ops instead of numbers
Intents bitfieldThe 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 namesThe same: MESSAGE_CREATE, GUILD_MEMBER_ADD, INTERACTION_CREATE, …
Message, reaction, server, member and audit log pathsThe same paths under /v1
EmbedsThe same fields and limits. No images, thumbnails or video yet
Mentions and allowed_mentionsThe same
Message nonceThe same, and it really prevents double posts
Audit log action_typeDiscord's numbers
Slash command JSON and bulk overwriteThe same. Option types 3 to 8 and 10
Interaction callback types 4 and 5, edit original, follow-ups, ephemeral flag 64The same, using the bot token instead of an interaction token
Execute WebhookThe same body for text and embeds

#What's different

DiscordLamma
Permission bitfieldsThe SDKs give Discord's bitfields. The raw API sends permission names, such as send_messages
Channel type numberThe SDKs give Discord's type. The raw API sends kind, such as text
retry_after in secondsMilliseconds on /v1 (seconds on webhooks, as on Discord)
Gateway resumeNot yet: reconnect and catch up over REST
ShardingNot needed: one connection per bot
Global commands take up to an hourGlobal commands appear at once
default_member_permissionsNot enforced yet: check permissions in your code

#Not offered to bots

Discord featureLamma
Direct messages, presence and typingNever offered to bots, for privacy. The SDKs behave as if every person had DMs closed
Kicking, banning, timing out and deleting other people's messagesNot in v1. Bots can still hear about them
Buttons, select menus, modals, autocomplete and subcommandsLater
Voice botsNot planned for v1
Threads, forums, stages and stickersLamma doesn't have them yet
Outgoing webhooksLater