lloesche / valheim-server-docker

Valheim dedicated gameserver with automatic update, World backup, BepInEx and ValheimPlus mod support
https://hub.docker.com/r/lloesche/valheim-server
Apache License 2.0
1.94k stars 272 forks source link

Some hooks aren't working #305

Closed Dani20000 closed 3 years ago

Dani20000 commented 3 years ago

I think this is not an Issue but that i'm doing something wrong. I'm trying to use a Discord webhook to inform about the valheim server in my discord. I don't understand why some hooks works and some doens't work... The ones related to start/shutdown of the server and to a player connecting are working but ones related to backup (see bolded text below) aren't. What am I wrong?

This is part of my valheim.env file:

DISCORD_WEBHOOK=https://discord.com/api/webhooks/... DISCORD_MESSAGEA=Accensione del server in corso... DISCORD_TEXTA=Il server è online! <:Valheim:809345344260407296> DISCORD_MESSAGES=Spegnimento del server in corso... DISCORD_TEXTS=Il server è offline. <:Valheim:809345344260407296> DISCORD_MESSAGEB=Backup in corso... DISCORD_TEXTB=Backup completato con successo! <:longship:723468339476955167> PRE_BOOTSTRAP_HOOK=curl -sfSL -X POST -H "Content-Type: application/json" -d "{\"username\":\"Valheim\",\"content\":\"$DISCORD_MESSAGEA\"}" "$DISCORD_WEBHOOK" POST_SERVER_LISTENING_HOOK=curl -sfSL -X POST -H "Content-Type: application/json" -d "{\"username\":\"Valheim\",\"content\":\"$DISCORD_TEXTA\"}" "$DISCORD_WEBHOOK" POST_SERVER_RUN_HOOK=curl -sfSL -X POST -H "Content-Type: application/json" -d "{\"username\":\"Valheim\",\"content\":\"$DISCORD_MESSAGES\"}" "$DISCORD_WEBHOOK" POST_SERVER_SHUTDOWN_HOOK=curl -sfSL -X POST -H "Content-Type: application/json" -d "{\"username\":\"Valheim\",\"content\":\"$DISCORD_TEXTS\"}" "$DISCORD_WEBHOOK" VALHEIM_LOG_FILTER_CONTAINS_BACKING=Backing up Valheim server worlds to ON_VALHEIM_LOG_FILTER_CONTAINS_BACKING=curl -sfSL -X POST -H "Content-Type: application/json" -d "{\"username\":\"Valheim\",\"content\":\"$DISCORD_MESSAGEB\"}" "$DISCORD_WEBHOOK" VALHEIM_LOG_FILTER_CONTAINS_BACKUP=Removing backups older than ON_VALHEIM_LOG_FILTER_CONTAINS_BACKUP=curl -sfSL -X POST -H "Content-Type: application/json" -d "{\"username\":\"Valheim\",\"content\":\"$DISCORD_TEXTB\"}" "$DISCORD_WEBHOOK" VALHEIM_LOG_FILTER_CONTAINS_Spawned=Got character ZDOID from ON_VALHEIM_LOG_FILTER_CONTAINS_Spawned={ read l; l=${l:46}; l=${l// :*/}; msg="$l è entrato nel server, vieni a giocare anche tu! "; curl -sfSL -X POST -H "Content-Type: application/json" -d "{\"username\":\"Valheim\",\"content\":\"$msg\"}" "$DISCORD_WEBHOOK"; }

Docker, by the way, executes the command (i saw in the logs), Like for others hooks that are working. The problem is that the bot on my Discord doesn't send anything when executes the ones related to backup hooks.

Don't mind the <> thing on DISCORD_VARIABLES, these are only Discord emoji. Anyhow i already tried to removing them. Thank you!

lloesche commented 3 years ago

The VALHEIM_LOGFILTER_* only filters Valheim logs. Not those of the container scripts like the backup script. Why not just use POST_BACKUP_HOOK?

Dani20000 commented 3 years ago

The VALHEIM_LOGFILTER_* only filters Valheim logs [...] Why not just use POST_BACKUP_HOOK?

Because i'm stupid, thats why. Sorry for have bothered you and thank you very much