Discord
One Discord application gives Lyna two things: the bot, and signing in with Discord on the web app. You can use either one alone.
1. Create the application
- Open the Discord Developer Portal and click New Application.
- Under OAuth2, copy the Client ID and reset and copy the Client Secret.
2. The bot
- Under Bot, reset and copy the Token.
- On the same page, under Privileged Gateway Intents, turn on Server Members Intent. Lyna needs it to give roles back to members who rejoin.
- Give the token to Lyna as
BOT_TOKENand keepbaseSettings.botEnabledon. - Set
baseSettings.botGuildto your server's id. Lyna serves one server, and registers its slash commands there.
To copy an id, turn on Developer Mode in Discord under Settings > Advanced, then right-click the server, a channel or a user and pick Copy ID.
Inviting the bot
Under OAuth2 > URL Generator, tick the scopes bot and applications.commands, then the
permissions below. Open the link and pick your server.
| Permission | Needed for |
|---|---|
| Manage Roles | Giving and taking the roles that come with licenses |
| Send Messages, Embed Links | Release posts and repository activity in channels |
| Send Messages in Threads, Create Public Threads | Posts into threads and forums |
| Manage Channels | Time channels, which rename a channel |
In Server Settings > Roles, drag the bot's role above every role it should hand out. Discord doesn't let a bot give a role that sits above its own.
Put the same invite into links.invite, so /info shows it.
Without a bot
Set baseSettings.botEnabled to false and leave BOT_TOKEN out. The web app, accounts, licenses
and downloads keep working. There are no roles, no slash commands and no posts in Discord, and only
operators can open the admin area.
3. Signing in with Discord
-
Under OAuth2 > Redirects, add your address with
/api/auth/discord/callbackat the end:https://lyna.example.com/api/auth/discord/callback -
Fill in the three settings:
discord:oauth:clientId: "YOUR_CLIENT_ID"clientSecret: ""redirectUri: "https://lyna.example.com/api/auth/discord/callback" -
Give the client secret as
DISCORD_OAUTH_CLIENTSECRET.
redirectUri must match the redirect in the portal character for character. Set all three settings
or none: with any of them empty, Discord sign-in is off and the web app says so.
Linking Discord is also what makes someone an admin: who may administer a server is decided by their Discord account. See first sign-in.