Skip to content

Reports user logins and logouts in Minecraft to Discord channel

License

Notifications You must be signed in to change notification settings

dblanken/minecraft-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minecraft-bot

Reports user logins and logouts in Minecraft through a discord channel.

How

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.

Channel commands

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

About

Reports user logins and logouts in Minecraft to Discord channel

Resources

License

Stars

Watchers

Forks

Packages

No packages published