diff --git a/Dockerfile b/Dockerfile index 03a3acf..43a7c7c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,6 @@ RUN apk add --no-cache bash curl WORKDIR /app COPY minecraft-discord-webhook.sh . +COPY ./lang ./lang -ENV FOOTER_TEXT="Minecraft Server" - -CMD ["bash", "-c", "./minecraft-discord-webhook.sh $WEBHOOK_URL ./latest.log $FOOTER_TEXT"] \ No newline at end of file +CMD ["bash", "-c", "WEBHOOK_URL=$WEBHOOK_URL SERVERLOG=./latest.log LANGUAGE=$LANGUAGE FOOTER=$FOOTER ./minecraft-discord-webhook.sh $WEBHOOK_URL"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..b3c43fb --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +# minecraft-discord-webhook +A small, server agnostic, way to push your server updates to Minecraft + +![image](https://user-images.githubusercontent.com/23201434/120118752-7e06c880-c16a-11eb-84fb-cce9fb123b38.png) + +This script will push your easily push: +- Server joins and leaves +- Deaths +- Advancements, challenges and goals + +to a Discord Webhook easily, with minimal configuration, and without needing server-side mods or plugins such as Spigot, Paper, etc (although it works with those servers as well!), meaning it also works with a vanilla server. + +This script works by reading your server log file, parsing and formatting it using Discord rich embeds, and pushing it to the webhook endpoint. + +## Usage + +### With Docker: + +There's an image avaible on [Docker Hub](https://hub.docker.com/r/saadbruno/minecraft-discord-webhook)! + +#### Docker run: +`docker run --name minecraft-discord-webhook -v /path/to/server/logs/latest.log:/app/latest.log:ro --env WEBHOOK_URL=https://discord.com/api/webhooks/111222333/aaabbbccc --env FOOTER=Optional\ Footer\ Text --env LANGUAGE=en-US saadbruno/minecraft-discord-webhook:latest` +> Note: FOOTER and LANGUAGE are optional + +#### Docker Compose: +``` +version: '3.3' +services: + minecraft-discord-webhook: + container_name: minecraft-discord-webhook + volumes: + - '/path/to/server/logs/latest.log:/app/latest.log:ro' + environment: + - 'WEBHOOK_URL=https://discord.com/api/webhooks/111222333/aaabbbccc' + - 'FOOTER=Optional Footer Text' + - 'LANGUAGE=en-US' + image: 'saadbruno/minecraft-discord-webhook:latest' + restart: unless-stopped +``` +> Note: FOOTER and LANGUAGE are optional + +### Without Docker: +- Clone the repo +- run `WEBHOOK_URL= SERVERLOG= FOOTER= LANGUAGE= ./minecraft-discord.webook.sh` + +## Variables: + +- WEBHOOK_URL: it's the discord webhook you want the notifications posted to. Read more at [Discord Support](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) +- LANGUAGE: The language of the notifications. This only supports joins and leaves. Advancements and death messages are posted "as is", meaning they'll be posted using the language of your server. Check the [lang directory](https://github.com/saadbruno/minecraft-discord-webhook/tree/main/lang) for currently supported languages. Contributions are welcome! +- FOOTER: An optional footer text that will be included with the notifications, you can put your server name, server address or anything else. You can also ommit this for a more compact notification. + ![image](https://user-images.githubusercontent.com/23201434/120119109-44cf5800-c16c-11eb-9ce1-8927629c805f.png) + \ No newline at end of file diff --git a/lang/en-US.sh b/lang/en-US.sh new file mode 100644 index 0000000..30c650d --- /dev/null +++ b/lang/en-US.sh @@ -0,0 +1,2 @@ +JOIN="$PLAYER joined the game!" +LEAVE="$PLAYER left the game... :(" \ No newline at end of file diff --git a/lang/pt-BR.sh b/lang/pt-BR.sh new file mode 100644 index 0000000..ca2e763 --- /dev/null +++ b/lang/pt-BR.sh @@ -0,0 +1,2 @@ +JOIN="$PLAYER entrou no servidor!" +LEAVE="$PLAYER saiu do servidor... :(" \ No newline at end of file diff --git a/minecraft-discord-webhook.sh b/minecraft-discord-webhook.sh index 679bb6f..4e10762 100755 --- a/minecraft-discord-webhook.sh +++ b/minecraft-discord-webhook.sh @@ -3,93 +3,103 @@ # Minecraft Discord Webhook. A simple, server agnostic, way to push your Minecraft server updates to discord. Works with any server and doesn't need mods and plugins. # MIT License # Documentation available at: https://github.com/saadbruno/appendhook -# Usage: ./minecraft-discord.webook.sh