DO NOT CONTACT ME ABOUT THIS PROJECT YOU WILL BE IGNORED AND LAUGHED AT
People have been reporting a lot of bans recently and at this point I lack the time and interest to continue maintaining this project as I no longer use Aternos.
If you're a developer and would like to continue this project, feel free to fork it.
If you're a user, please strongly consider exaroton instead. It's a reliable Minecraft server hosting solution for dirt cheap by the people behind Aternos and they have an official discord bot that (obviously) doesn't break TOS.
⚠️ Your aternos account may be banned at any time. Use this software at your own risk. For more information read our TOS.
Simple Aternos discord bot to start & stop your Minecraft server.
Built using aternos-api.
If you're here looking for an invite link, read termination of the public (demo) bot.
Starting and stopping the server is fully asynchronous. You can query the current status at any time:
And you'll get notified once the server goes online or offline:
All available slash commands.
Instructions to host this bot yourself. If you were expecting an invite link, read termination of the public (demo) bot.
Replit is not supported for hosting because it's IP banned by aternos/cloudflare.
Requirements:
Configuration parameters are set through environment variables.
Variables that don't exist or are empty =""
will be ignored.
There's several ways to get this bot up and running in production.
Download the binary from releases or compile it, set the required environment variables & run the bot.
Linux/MacOS:
$ DISCORD_TOKEN="" MONGO_DB_URI="" ./aternos-discord-bot
Windows:
$ set DISCORD_TOKEN=<value>
$ set MONGO_DB_URI=<value>
$ aternos-discord-bot.exe
Other platforms:
Set the environment variables locally (or globally, if you must) and run the binary. It will show an error message when the required variables aren't set. RTFM if you don't know how to do this.
Compilation instructions (requires Go version 1.18+):
$ git clone https://github.com/sleeyax/aternos-discord-bot.git
$ cd aternos-discord-bot
$ go build -o aternos-discord-bot ./cmd/main.go
This should create a binary targeting your current platform. Follow the CLI binary instructions to execute it.
You can also run the bot in a docker container:
docker run -d --name aternos-discord-bot -e DISCORD_TOKEN="" -e MONGO_DB_URI="" sleeyax/aternos-discord-bot
You can use docker compose to spin up a local MongoDB database as well (only recommended for development though):
docker-compose up -d
See scripts for a production-ready installation script that does most of the Docker setup for you on a Linux VPS.
Deployment to a kubernetes cluster is also supported.
kubectl create ns aternos-discord-bot
<>
with the respective values): kubectl create secret generic aternos-secrets --from-literal=DISCORD_TOKEN=<> --from-literal=ATERNOS_SERVER=<> --from-literal=MONGO_DB_URI=<> --from-literal=ATERNOS_SESSION=<>
kubectl apply -n aternos-discord-bot -f ./kubernestes.yaml
WARNING you'll most likely need to edit this configuration for your specific needs. Feel free to create a PR with proper helm chart support.Running the bot on replit is not recommended because it's slow and could be IP banned easily, though if you really want to use it you can run or fork this template. A paid replit account is likely required for this to work.
It's possible to integrate this package into existing go code. Useful if you want to further customize the bot or want to do additional things after launching it.
Installation:
go get github.com/sleeyax/aternos-discord-bot
Code:
package main
import (
"fmt"
discord "github.com/sleeyax/aternos-discord-bot"
database "github.com/sleeyax/aternos-discord-bot/database"
"os"
"os/signal"
"syscall"
)
func main() {
// Create bot instance with an in-memory database (only supports 1 discord server).
bot := discord.Bot{
DiscordToken: "<your discord bot token>",
Database: &database.MemoryDatabase{}, // no initial values are provided, so they must be set with `/configure` later on
}
// Start the bot (errors are omitted for simplicity reasons).
bot.Start()
// Stop the bot when the main function ends.
defer bot.Stop()
// You can put some additional code here, for example.
//...
// Block the main thread so the bot keeps running.
// In this case we wait until 'CTRL + C' or another termination signal is received.
fmt.Println("Bot is now running. Press CTRL-C to exit.")
interruptSignal := make(chan os.Signal, 1)
signal.Notify(interruptSignal, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
<-interruptSignal
}
Licensed under MIT License
.
A short, permissive software license. Basically, you can do whatever you want as long as you include the original copyright and license notice in any copy of the software/source. There are many variations of this license in use.