Reports user logins and logouts in Minecraft through a discord channel.
To accomplish this, the bot monitors the log file generated by the minecraft server. If it notices someone logging in or out, it will pass that on to the discord channel you specify.
This app takes advantage of a local environment to set up the bot. To use, place a .env file in the root of the directory with the following environment variables:
- DISCORD_BOT_TOKEN: The bot token to bind to
- DISCORD_CHANNEL_ID: The channel to log to
- ADMIN_ID: The discord ID number of yourself so you can send commands to the channel
- LOGFILE: The minecraft logfile to keep track of
Sample .env:
DISCORD_BOT_TOKEN=12345678
DISCORD_CHANNEL_ID=71234567
ADMIN_ID=12343434334
LOGFILE=/opt/minecraft/server/logs/latest.log
From there, you use a process management tool, like pm2, to handle spinning up the application.
If you are the admin of the bot, you can perform the following in the same channel:
- channel <new_channel_id>: Sets the bot to use a new channel to log to
- channel reset: Resets the channel to the one specified in the .env