Admin Panel
Website & Discord Bot
Run the panel in a browser with Discord login, and use the panel from Discord slash commands.
Website
The website runs inside lg_admin - nothing else to install. Staff log in with Discord and get exactly the permissions they have in game, plus they need web.panel. Everything they do shows up in game right away, and the other way around. Actions that need you in the game (go to, bring, spectate, noclip ...) are greyed out.
Without a domain
- Set
Config.Web.Enabled = trueand restart lg_admin. The console prints the address, e.g.http://1.2.3.4:40125. - Open the port (40125, TCP) in your firewall / hosting panel.
- Fill
ServerConfig.DiscordClientIdandServerConfig.DiscordClientSecret(discord.com/developers > your application > OAuth2). - Add the redirect under OAuth2 > Redirects:
http://YOUR-SERVER-IP:40125/auth/callback.
With your own domain (HTTPS, recommended)
Write it in Config.Web.Domain, e.g. admin.myserver.com. lg_admin downloads Caddy by itself (once, from Caddy's official GitHub, checksum checked), gets a free HTTPS certificate and serves the panel on ports 80 and 443. Add a DNS A record for the domain pointing to your server (Cloudflare: DNS only / grey cloud), open ports 80 and 443, and use https://admin.myserver.com/auth/callback as the Discord redirect.
Before the Discord login is set up you can still log in: type lgadmin_weblink <discord id> in the server console for a one-time link (5 minutes, staff with web.panel only).
Security
- Sessions are random tokens stored hashed; cookies are HttpOnly and SameSite (and Secure with a domain).
- Every request needs a valid session and a custom header (no cross-site requests), logins are rate limited, the Discord login checks its state value.
- Settings > Website logins shows every browser logged in with your Discord (device, IP, last seen) with "log out" and "log out everywhere". Staff with
web.sessionscan end the logins of lower-ranked staff.
Discord bot commands
Set Config.Bot.Enabled = true and restart. The commands appear in your Discord within a minute (if not, invite the bot again with the applications.commands scope). Staff need discord.commands plus the permission of each action.
Pick the commands per role
In the role editor, the gear next to discord.commands opens Discord bot access. Automatic (default): every command and action the role has a permission for. Manual: pick the commands, and inside each one every action on its own - for example /vehicles can see vehicles but not delete them. An action works only when it is picked there and the role has its permission. This only limits the bot - the same role works as usual in the game and on the website.
| Command | What it does |
|---|---|
/player | Profile card: online state, playtime, warnings, bans, characters and quick actions |
/inventory · /giveitem | A picture of the inventory, give / remove items, clear |
/vehicles · /givevehicle · /spawncar | Every vehicle: garage, plate, max performance, transfer, delete, add; spawn a car next to a player |
/houses | Houses of a character: owner, keys, door codes, storages (open and edit) |
/character · /money · /setjob · /setgang | Character details and edits |
/revive · /heal · /armor · /feed · /kill · /freeze · /disarm | Player actions |
/kick · /warn · /ban · /unban | Moderation (offline bans take every identifier and hardware token the player ever used) |
/dm · /troll · /announce | Message on the player's screen, troll actions, announcements |
/players · /staff · /reports · /version | Who is online, online staff, read / reply / claim / close reports, your version and what changed since then |
Rename any command or set it to false in Config.Bot.Commands. Config.Bot.Private = true shows answers only to the staff member who used the command.
Last updated