Have you ever wanted your friends to get notified when you start up a game?
Have you only wanted certain friends to get notified about certain games?
This is the bot for you!
This bot monitors the gaming activity of users in your Discord server and sends alerts to specified users when their friends start playing certain games.
- Monitors user presence for game activity
- Allows users to subscribe to game alerts for specific friends
- Supports adding and removing game subscriptions via commands
- Provides commands to view current subscriptions and subscribers
- Implements a cooldown system to prevent spam
- Forwards messages from subscribers to the target user
- Create a new Discord application in the Discord Developer Portal.
- Add a bot to your application and copy the bot token.
- Invite the bot to your server with necessary permissions. You'll follow general instructions for setting up a discord bot.
-
Clone this repository:
git clone https://github.com/yourusername/discord-game-alert-bot.git cd discord-game-alert-bot
-
Install dependencies:
yarn install
-
Copy the
.env.example
file to.env
and update it with your bot token and other necessary values:cp .env.example .env
-
Start the bot:
yarn start
/notifier add <watcher> <notifier> <game>
: Add a game subscription/notifier remove <watcher> <notifier> <game>
: Remove a game subscription/notifier get-subscriptions [user]
: View games you're subscribed to (or another user's, if specified)/notifier get-subscribers [user]
: View who is subscribed to your games (or another user's, if specified)
The bot uses a JSON file (gameMap.json
) to store subscription data. Here's an example structure:
{
"users": {
"Matthew": {
"userId": "222537364092289024",
"subscribers": {
"Joshy": ["HITMAN World of Assassination", "HITMAN 3"],
"MJ": ["League of Legends", "Marvel Rivals"]
}
},
"Joshy": {
"userId": "222189792489046017",
"subscribers": {}
},
"MJ": {
"userId": "222129559303487488",
"subscribers": {}
}
}
}
In the example above (user IDs have been changed), we can provide a human-readable name among the list of games.
When Matthew
has a change in gaming presence, the bot will check if the game name has a hit for any of the subscribers,
at which point the bot will message them. If he plays Marvel Rivals, then MJ
will receive a message about that.
For the bot to function correctly:
- Users must share a server with the bot
- Allow messages from server members (at least for the shared server)
- Have their privacy settings configured to allow non-friends to message them
The bot implements a 2-hour cooldown per game to prevent excessive notifications.
When subscribers reply to the bot's alerts, their messages are forwarded to the notifying user. The user can reply using the reply
function on the forwarded message.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the GNU General License - see the LICENSE file for details.