A full changelog
- Missing dependency in final bundle (error in csharp project file)
A full leaderboard overhaul is in the version. The previous settings for the statistic leaderboards are depreciated in favor of configuration defined statistic leaderboard settings. Look in the
discordconnector-leaderboards.cfg file and configure any number of the 4 leaderboards to present the kind of data you want. In addition to multiple leaderboards, there are now time-based filters for the leaderboards; restrict them to today or this week or leave them set to all-time. By default, all leaderboards are disabled. If you were using a leaderboard before, you will have to set up a leaderboard to accomplish what you were sending before and enable it. Sorry for the inconvenience but this was the safest tradeoff.
Also relating to statistic leaderboards, there is a new statistic available for the leaderboards, ‘Time Online’ which uses the saved ‘join’ and ‘leave’ records to estimate a player’s time on the server and present that as a value. This obviously doesn’t work if you had disabled one or the other pieces of tracking (either disabled recording ‘join’ or ‘leave’ stats in the toggles config file). This values are calculated when the leaderboard is created but that should be OK since it is in a non-blocking task call.
The new Active Player’s Announcement can be configured to announce server activity at a pre-defined interval. Configurable stats for it include players currently online, unique players online today, unique players online this week and unique players all time. It will use the same method set in the main config file (
discordconnector.cfg) for how to determine individual players to count unique players for these time spans.
Additionally, the configuration files are nested in a subdirectory now. This is from a request on the plugin repository. When loading 2.1.0 (or future versions), the Discord Connector config files that are in the
BepInEx/config directory will be automatically moved to the subdirectory and loaded from there. The subdirectory is
BepInEx/config/games.nwest.valheim.discordconnector, and the config files themselves have shortened filenames. The records database is also moved to this subdirectory and renamed
- Adds new tracked stat for time on server (only works if you have enabled join and leave stats)
- Adds dynamically configured leaderboards (disabled by default)
- Adds an Active Players Announcement (disabled by default)
- Configuration files are now nested in a subdirectory (first run will migrate them automatically)
- Database file moved into the subdirectory (first run will migrate it automatically)
config-debug.jsonfile is dumped to subdirectory after config load to be useful for debugging issues with the plugin (sensitive info is redacted, i.e. the webhook url)
- Multiple-choice config options use Enums on the backend now instead of Strings (may affect
discordconnector.cfg: How to discern players in Record Retrieval)
- Building the plugin with the optimization flag present; in my tests, startup time of a Valheim server with just DiscordConnector installed was quicker
- Public IP is only queried if it is used (by including the %PUBLICIP% variable in a message)
%WORLD_NAME%will now only replace with world name once server has started up to avoid an issue with Key Manager
- Further guards against null-reference exceptions
- Fixes plugin crash that could occur if the game was initiated more than once.
- Removed extraneous discord message on server load
- Adds a config option to format how position data is formatted
- Adds a config option to format how the automatically-appended position data is formatted
- Adds a new variable which can be used in any messages:
%WORLD_NAME%turns into the name of the world.
%POS%now renders without the enclosing parentheses.
- Adds a config option to enable sending non-player shouts to Discord. This is in the main config file and disabled by default.
- Set BepInEx dependency to exactly 5.4.19 instead of 5.* (this stops a warning from showing up)
If a shout is performed by a player that isn’t a real player (like a mod), it would break the shout call from working. This is because Discord Connector was trying to lookup the player’s details and encountering null. The plugin now checks for that and returns early if null is found.
- Detect if a shout is by a non-player and gracefully exit.
With this update, we bring back Steam_ID variable inclusion and leader board message sending (respecting your config settings). I recommend you replace your
discordconnector.valheim.nwest.games-records.db database, since the records will not line up and will be essentially soft-reset because the column name changed with the different type of data. Steam IDs are prefaced with ‘Steam_’ now, so you could migrate your stat database with a bit of effort. I believe this could all be done with queries inside the LiteDB Query Tool.
- Periodic leader board messages sending will now respect your config value instead of never sending
%STEAMID%variable works again. An alias is the
%PLAYERID%variable, which does the same thing – they both provide the full player id, so
- Player IDs are tracked in the stat database using a new column name, which resets any stat tracking because the player ID is used to resolve to a single player by combining with the character name.
Previous version broke with the new updates to Valheim using the PlayFab server stuff. Previously, the steam ID was grabbed directly from the socket but that doesn’t work anymore. To get something workable (the other messages work), I have removed the code which tried to get the SteamID and disabled leader board sending.
- Removed steamid variable (internally) and tracking stats by steamid. This broke with the PlayFab changes to Valheim. It will be a bit involved to figure out how to deliver the same thing again, so if you have an idea or seen it done in another mod, please reach out with a Github Issue or ping on Discord.
- Leader board records will reset and a new database with suffix ‘-records2.db’ will be saved anew. This is because what is being tracked is changed (used to be steamid, now it is using the character id).
- Periodic leader board messages will not send, ignoring the setting in the config (for now). This is until a more reliable method of determining players apart.
- Web requests to Discord API are async instead of blocking the main thread
- Handles the edge case when a toggle was enabled but the text in ‘messages’ for that toggle was blank, the plugin would crash. (e.g. if ‘send shout’ toggle was
truebut the ‘shout message’ was blank, in prior versions this would crash the plugin)
- Ignore player regex was matching everything if not set. Now if it is not set, it will match nothing.
- Player shout messages were not including enough information for formatting. Now they properly include steamId and shout text.
- New variable available for messages:
%PLAYER_STEAMID%which gets replaced with the player’s Steam ID
- Switched from ipify.org to ipconfig.me for grabbing public IP address
- Errors when accessing the ignored players regex
There was a typo that was affecting the way the config file was read. I didn’t run into this in my testing on Windows but was able to duplicate this on Linux after it was reported. Thank you to those who reported this.
Finally a new release! This on is mainly some small features and bugfixes from the github issues backlog.
- New configuration setting, “Ignored Players (Regex)” lets you specify a regular expression to ignore players.
- Configuration is reloaded when a change is detected.
- The records database is saved in the BepInEx config directory.
- Handle exceptions that occur when checking the public IP from ipify.org
- Fully quality the records database to avoid any possible conflicts
- Removed conversion code which would convert
If you need to make use of that automatic conversion, load the 1.5.3 version of the plugin once before upgrading.
- Leader board interval was half of what was configured (now is properly minutes)
- Highest and Lowest leader boards were not checking the correct tables
- Configurable retrieval strategy for all records (either SteamID, PLayer Name, or both) – always returns player names
Due to how records.json recorded stats and the LiteDB, you will not be able to use the old records with strategies involving the SteamID because prior to 1.5.0 we were not recording the SteamID with the record.
- Toggles for the bottom n players leader boards (inverse ranked leader boards)
- Using LiteDB for record storage.
Because of how unreliable storing the records in a “roll-your-own” database with a JSON file was, and because of the increased flexibility in what could be stored, I’ve changed the storage system for the recorded player stats to use LiteDB. Currently this means records for join/leave/death/shout/ping will be timestamped, include the position of the event, have the player name, and the player’s steamid. Hopefully adding this additional information will allow for more customization options for the users of this mod.
It is set up to do a migration on first load of the updated plugin, the steps it follows for that is:
1. check if records.json (or configured name) exists 2. read all records from the file 3. parse the records 4. loop through all the records and add them to the database Records added this way will have position of zero and a steamid of 1. 5. move the records.json file to records.json.migrated
If you don’t want to have it auto-migrate the records, rename your records.json or delete it. If the name does not match exactly it will not migrate the data.
For the migration steps, it will be outputting log information (at INFO level) with how many records were migrated and which steps completed.
- Ranked Lowest Player Leader board
Added an inverse of the Top Player leader board.
- Custom leader board heading messages
Added configuration for the messages sent at the top of the leader board messages.
- The variable
%PUBLICIP%can be used in any message configuration now.
- Position being sent with event messages even if event position was disabled in config
- Event messages were sending the wrong message (start instead of end and vice-versa)
- Event Stop messages were sending zero coordinates
- If you had enabled first death message and death message (this is default settings), you would get two messages. This has been changed to merge the messages into one if both settings are on and it’s a player’s first death.
- Added toggles to enable/disable some event debug messages (all disabled by default)
- Added a toggle to enable/disable a debug message with responses from the webhook (disabled by default)
- Least deaths leader board wasn’t respecting the correct config entry. (THanks @thedefside)
- Removed the two debug logging calls for events – sorry for the log spam!
- 10 user defined variables that can be used an any messages (%VAR1% thru %VAR10%). These are set in their own configuration file,
games.nwest.valheim.discordconnector-variables.cfgwhich will get generated first time 1.4.0 is run.
- The position of where the player/ping/event coordinates are inserted into messages is configurable using the
%POS%variable in the messages config. It won’t be replaced if the “send coordinates” toggle is off for that message. If you don’t include a
%POS%variable, it will append the coordinates as happens with previous versions.
- Fixed an off-by-one error in the Top Players leader board (the default leader board) (Thanks @thedefside)
- Fixed configuration not referencing proper settings (Thanks @thedefside)
- Fixed event messages (now properly functioning on dedicated servers)
- If you used
%PLAYERS%in any of the event messages, you need to remove it. With the changes required for the event messages functionality, it is not supportable at this time.
- Additional leader board options. The existing leader board option will now default to sending top 3 players for what is enabled. You can enable a highest and lowest leader board for each tracked stat now. All leader boards get sent on the same interval.
- No shutdown message when some other mods are loaded (Like World of Valheim suite)
Also this update modifies when the startup, shutting down, and shut down messages are sent. There now will likely be a bit of a pause because the startup message gets sent when the game is initialized instead of when the loading of the map starts for the server.
- The leader board toggles were not working properly, behind the scenes they were all following the death leader board toggle
A breaking change was found with the records.json in 1.2.0. The records.json file needs to have all
PlayerName changed to
If you are seeing an error message in your logs from Discord Connector, this is the likely culprit (should see something about
JsonException I believe). For example:
records.json pre 1.2.0:
records.json 1.2.0+ (PlayerName changed to Key)
%PUBLICIP%message variable available in the server messages
There is no variable for what port the game is running on since I figured that had to be set manually in the first place (if not default),
and you should be able to modify the message to be something like
Join the server on %PUBLICIP%:2457 or similar if you want to.
- Messages for events start/pause/stopping
A feature that I wanted finally added. This was difficult to test in a server environment and I did the testing running on the client and then the client running as a server. In those instances I verified that the messages were fired when events started, ended, paused or resumed. The resume message is the same as the start message by default because I couldn’t think of a way to word it that made sense.
- Stop and Loaded config values were using the same value as launched on the backend and not respecting the actual config.
- Send a message when the server saves the world
- Configuration file comments should be clearer/easier to understand
Release 1.0.0 is a breaking release since the structure of the configuration files completely changes. When you update you will need to modify the config to save your webhook again and to update any message customization you have done!
- Send an extra message the first time a player does something (by default only for Join and Death on server)
- Configuration is “simpler” with other configuration files to consult for full customization
- Server shutdown message
- Global toggles weren’t being applied
- Mention Mod Vault in readme
This version included a source code restructuring which should make it easier to maintain in the future.
Hotfix: Message toggles don’t act independently.
This is fixed and you can have join messages disabled and death messages enabled and get death messages sent.
- %PLAYER_NAME% is replaced in messages with the player name, allowing you to change where in the message the player is mentioned (Thanks @Digitalroot)
- Configurable Ping and Shout messages
- More robust dedicated server detection (Thanks @Digitalroot)
- Time interval for leader board in minutes not seconds.
- Don’t display a leave message for disconnects due to version mismatch
Default config options are updated to be true for all notification and coordinates.
- Periodic stats leader board functionality (opt-in)
- Corrected duplicate “join” message when player dies
- Correctly looks at leave config option before sending leave message
- Correctly looks at join/death config option before sending messages
- Loaded config is now debug logged to make debugging easier
Added a Death detection and config options to enable/disable the messages as well as set either a single message or list of messages to be chosen from when sending a message.
Version 0.7.2, 0.7.3¶
Hotfix for mis-packed plugin
Added config option to ignore players when sending shout messages to Discord.
- properly check for dedicated vs non-dedicated servers
- when sending position (POS or coordinates) with the message, will use an embed to improve visibility (if enabled)
- added config options to enable/disable sending position with join and leave
- added config option to enable/disable using the embed with discord when sending position data (disabled by default, I find it very busy when enabled atm)
- added config option to enable/disable sending position with pings
Enabled for both the client and server versions of Valheim.
Key differences if running a server from the client:
- No Launch/Startup message is sent. This is because when the server launches it immediately begins loading the world, but for the client it is loading into the main menu. This may be fixable in the future to be a hook that goes before the world begins getting loaded to keep the functionality on the server and to enable similar functionality on the client.
- removed ‘$’ before the position for ping messages
New this version:
- stats recording
Added a stat recording mechanism. This will record the player name and the trigger (join, leave, shout, or ping) when a notification is generated for Discord. These are stored in a ‘records.json’ file in the game server directory. The plan is to (optionally) incorporate these stats into the messages sent to Discord. For example, when you log in, it adds a little context: “John joined the game for the 1st time!” or “Stuart arrives. Previous logins: 15”. The context additions are not yet created but record-keeping is ready and makes sense to get it started as soon as possible.
If you want to disable the record keeping in its entirety, set the Collect Player Stats config value to false. This will prevent any records from being saved or written to disk.
Allows for randomized messages to get sent. If you want only one message to be sent (the existing functionality 0.4.0 and earlier), you don’t need to change anything, and default configuration will only have one message for each notification. If you would like to have a random message chosen each time, add multiple messages for each config value and separate them with a semicolon ‘;’. Then, when Discord notifications are sent, a random message will be sent from what you have provided.
- Randomized messages amongst configured messages (separated with semicolon)
- If you used a semicolon in your message, it will be seen as multiple messages
- Player leave messages
Thanks to a contribution from Digitalroot, player join and leave messages are now implemented. You can modify what is announced when players join and leave or toggle them on or off.
This removes the PlayerArrival settings.
When the server loaded it was sending the same message from the launch.
Added 3 messages from hooking into the chat on the server. This includes:
- Players joining the server
All 3 are togglable and can have the position toggled separately.
To include when players leave, more work has to be done because those events are not broadcast and instead it is only network messages.
- Use config values to set what messages get sent for what actions
- More granularity with Enable/Disable for existing messages
Added link to a how-to guide for creating a discord webhook.
Initial release. Configuration and sends messages on server startup and shutdown. Essentially a minimally viable product.
- Configuration file with webhook and enable disable for each notification
- Ability to send messages to a Discord webhook
- Detection and message sent for:
- server starting
- server started
- server stopping