Getting started
Build your first bot
Make an app, install it in a server and run a bot that answers a message and a slash command.
This guide makes an app, installs it in a server you manage, and runs a bot that answers !hello and a /ping command.
#1. Create an app
- Open Lamma and go to User Settings › Developer.
- Type a name (2 to 32 characters) and select Create app.
- Open the app. Under What installs ask for, keep
bot,messages.sendandcommands, and add the intents your bot needs. This guide uses Server, channel and role changes, New, edited and deleted messages and The text of every message it can see (Guilds,GuildMessagesandMessageContentin discord.js). - Select Save changes.
The text of every message it can see (MessageContent) is privileged. While you develop, it works in up to five servers you own. For other servers the app needs review.
#2. Get a token
Under Bot token, select Reset token and copy it. It starts with lmb1_ and is shown only once.
#3. Install it in a server
Copy the Install link (https://lammapp.sa/app?app=<application id>) and open it. Pick a server you manage, check what the app asks for, and approve. The bot joins with an App badge and its own role.
#4. Run the bot
The SDKs aren't published to npm or PyPI yet. Until they are, the same bot can talk to the REST API and gateway directly from any language. With lamma.js:
import { Client, Events, GatewayIntentBits, SlashCommandBuilder, MessageFlags } from 'lamma.js';
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]
});
client.once(Events.ClientReady, async ready => {
console.log(`Ready as ${ready.user.username}`);
const ping = new SlashCommandBuilder().setName('ping').setDescription('Check the bot');
await ready.application.commands.set([ping]);
});
client.on(Events.MessageCreate, async message => {
if (!message.author.bot && message.content === '!hello') await message.reply(`Hello, ${message.author.displayName}!`);
});
client.on(Events.InteractionCreate, async interaction => {
if (interaction.isChatInputCommand() && interaction.commandName === 'ping') {
await interaction.reply({ content: 'Pong!', flags: MessageFlags.Ephemeral });
}
});
client.login(process.env.LAMMA_TOKEN);The same bot with lamma.py:
import lamma
from lamma.ext import commands
intents = lamma.Intents.default()
intents.message_content = True
class MyBot(commands.Bot):
async def setup_hook(self):
await self.tree.sync()
bot = MyBot(command_prefix='!', intents=intents)
@bot.command()
async def hello(ctx):
await ctx.reply(f'Hello, {ctx.author.display_name}!')
@bot.tree.command(description='Check the bot')
async def ping(interaction: lamma.Interaction):
await interaction.response.send_message('Pong!', ephemeral=True)
bot.run() # reads LAMMA_TOKENGlobal commands show up in every server at once, so /ping is ready as soon as the bot starts.
#5. Try it
In a channel the bot can see, send !hello, then type /ping. The answer to /ping is ephemeral: only you see it.
#Without an SDK
Any HTTP client and WebSocket library will do. Send the token on every request:
curl https://lammapp.sa/v1/users/@me \
-H "Authorization: Bot $LAMMA_TOKEN"Then follow Gateway to receive events.