https://github.com/dairefinn/discord-bot
Bot for managing roles and mentions in our Discord server
https://github.com/dairefinn/discord-bot
discord discord-api discord-bot
Last synced: 14 days ago
JSON representation
Bot for managing roles and mentions in our Discord server
- Host: GitHub
- URL: https://github.com/dairefinn/discord-bot
- Owner: dairefinn
- License: apache-2.0
- Created: 2023-10-26T11:56:29.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2026-05-04T23:19:55.000Z (28 days ago)
- Last Synced: 2026-05-05T01:23:28.099Z (28 days ago)
- Topics: discord, discord-api, discord-bot
- Language: TypeScript
- Homepage:
- Size: 614 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE_APACHE
Awesome Lists containing this project
README
# Overview
This is a bot for the Discord app which I am creating because I am bored waiting for the game "The Lord of the Rings: Return to Moria" to install :)
I've recently started developing it again because I want to manage roles on my server. We have a role for every game we play and if we want to play it, we'll usually mention the role in the chat using @.
This bot allows me to create new roles for any games we are playing. For Example I could use `/registergame Arc raiders` to create the "Arc raiders players" role. Anyone interested in playing can use the `/addgame` command to add themselves to the new role and when someone types `@Arc Raiders Players` in a channel they will be notified. When a person decides they no longer want to play a game they can use `/removegame` to remove themselves from the role. If nobody is playing a game anymore and I don't see us playing again in the future I can use `/unregistergame` to delete the role.
`/addgame`, `/removegame`, `/unregistergame`, `/listgame`, and `/registerplayer` have autocomplete suggestions which query the existing roles and members to suggest them to the user. The bot knows which roles to suggest because all the game roles end with " players" - this is just a convention I've chosen to make it easier to identify the game roles without having to use any sort of database.
## Slash command registration
When this bot is first invited to a server the only command available will be `/synccommands`. Running this will add all of the other commands to the server.
This is done so to make development easier. When new commands are added you usually have to wait for Discord's scheduler to run and sync them or just re-invite the bot to the server - I don't want to do this :).
If anyone ever decides to deploy this bot to a new environment they can run `yarn register-sync-global` to register `/synccommands` as a global command.
`yarn register` does essentially the same thing as `/synccommands` but it needs some environment variables to be set locally. Use it if you want to register the commands from the terminal instead of Discord.
# Features
## Game role management
I'm using this bot to manage roles on my server. Admins can register and unregister games that players are playing in their server. Players can then opt in to roles related to these games. This allows players to mention the role in the chat to try and get others to play with them.
**Commands:**
- `/addgame ` - Adds you to the role of the provided game if it exists.
- `/removegame ` - Removes you from the role of the provided game if it exists.
- `/listgames` - Lists all registered games, split into games you've joined and games available to join.
- `/listgame ` - Lists all members who currently have that game's role.
- `/registergame ` - _(Admin)_ Registers a game with the bot. This will create a new role with the name of the game.
- `/registerplayer ` - _(Admin)_ Adds one or more members to a game role. Use mentions, user IDs, or autocomplete; you can paste several at once for bulk adds.
- `/unregistergame ` - _(Admin)_ Unregisters a game with the bot. This will delete the role with the name of the game.
## Event announcements
Admins can broadcast Discord events to the server with an `@everyone` mention so nobody misses out. The bot validates and reconstructs the event URL to prevent abuse of the `@everyone` ping.
**Commands:**
- `/event init ` - _(Admin)_ Posts an `@everyone` announcement linking to the provided Discord event.
## Utility & admin
A handful of commands for bot administration and diagnostics. `/synccommands` pushes the latest command definitions to a server, while `/ping` and `/echo` are quick health-checks.
- `/synccommands` - _(Admin)_ Updates the list of slash commands available on the current server.
- `/ping` - _(Admin)_ Replies with "Pong!".
- `/echo ` - _(Admin)_ Echoes the provided message back.
# Environment variables
- DISCORD_TOKEN - The token used to authenticate with the Discord API
- DISCORD_CLIENT_ID - The client ID used to identify the user authenticating with the Discord API