Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When shouts enabled, empty "Player Shout Message" prevents chat from working #117

Closed
PaloAlo opened this issue Aug 6, 2022 · 8 comments · Fixed by #118
Closed

When shouts enabled, empty "Player Shout Message" prevents chat from working #117

PaloAlo opened this issue Aug 6, 2022 · 8 comments · Fixed by #118
Labels
enhancement New feature or request

Comments

@PaloAlo
Copy link

PaloAlo commented Aug 6, 2022

hi, im running a modded valheim server and all global chat is blocked on the server. i tried with the vanilla chat client, and also with Chatter mod, but in each case global chat is blocked. people can use local and whisper mode chat, but global is not working. and it looks like discord connector is spitting a lot of errors into my server log.

edit: i had "Player Shout Message = " left blank, because i dont want every single shout msg sent to the server, nor the pings, but when it's blank then global chat is blocked. when i put the option back in then it works and people can shout on the server again. thats not a great option because it causes a whole lot of extra traffic from client to server that i dont want.

so, i spoke to a coder (not a skillset thats in my wheelhouse) and she told me to "Tell the mod author that":

/// <summary>
/// Sends a <paramref name="message"/> to Discord.
/// </summary>
/// <param name="message">A string optionally formatted with Discord-approved markdown syntax.</param>
public static void SendMessage(string message)
{
// A simple string message
var payload = new DiscordSimpleWebhook
{
content = message
};
string payloadString = JsonConvert.SerializeObject(payload);
SendSerializedJson(payloadString);
}

needs to be wrapped in a try-catch{} so that it doesn't stop the rest of the game code from continuing normally.

i hope that information is somewhat useful, and thx for reading this. idk if this is correct or not, but im experiencing issues disabling options in the config which im hoping you can take a look at. Log file entry below showing the error.

LogOutput for discord connector.txt

@nwesterhausen nwesterhausen added the bug Something isn't working label Aug 6, 2022
@nwesterhausen
Copy link
Owner

If you want to disable the shout messages being sent, you should change the value in the toggles configuration to disable it.

Set 'Send Player Shout Messages' to false in games.nwest.valheim.discordconnector-toggles.cfg (doc reference)

I will add some extra case handling for when people have shout messages enabled but a null shout message configured.

@nwesterhausen nwesterhausen added enhancement New feature or request and removed bug Something isn't working labels Aug 6, 2022
@nwesterhausen nwesterhausen changed the title global chat blocked When shouts enabled, empty "Player Shout Message" prevents chat from working Aug 6, 2022
@nwesterhausen
Copy link
Owner

DiscordConnector.zip

This version has a code addition that I think will fix this for you if you leave your settings the same, if you want to try it.

@PaloAlo
Copy link
Author

PaloAlo commented Aug 6, 2022

i will try that fix you posted. the issue is i didnt want to have pings or shouts sent to the log, so i left the field blank, but that broke global chat.

in the toggles.cfg i had the option "Chat Shout Messages Notifications = true" but i have now changed it to false.

so, i will test first with the other field "Player Shout Message = " left blank or with "Player Shout Message = %PLAYER_NAME% shouts %SHOUT%. and see if it causes error in log or blocks global chat. but in order to test your zip file i would have to shut down the server and i can't do that for a couple days. i never reboot the server on a weekend, way too many players online.

@PaloAlo
Copy link
Author

PaloAlo commented Aug 7, 2022

okay, it working well now. i tested with:
"Chat Shout Messages Notifications = false" and "Player Shout Message = %PLAYER_NAME% shouts %SHOUT%. and no probs.
also
"Chat Shout Messages Notifications = false" and "Player Shout Message = (blank)
and that also works no probs.
so, it seems the only problem was when i had the toggle set to "true" and the the msg field left blank which caused log errors and broke global chat.
if and when i get the time this week i will try to test the file you sent and report back

@nwesterhausen
Copy link
Owner

Thanks for the feedback. I'm pretty confident you outlined exactly why the chat was breaking, with the toggle set true but the message blank. I will try and test the fix I posted with those settings this weekend as well, just to confirm. If that addresses that combination of settings, I think I will have to add a configuration sanity check as well, to run when loaded, to check if there are other mismatching toggle and message settings and put out a message. (The fix I put in place should handle any of those as well, however.)

@PaloAlo
Copy link
Author

PaloAlo commented Aug 7, 2022

while we are on topic, theres another issue i was going to mention as well. i was following a discussion in discord about why someone said they wouldnt use your mod, and the coder person said "it's not async and the timeout is way too high. if discord fails to reply for whatever reason, the discord connector blocks the server, until all connected players time out."
and then another coder replied "he didn't put webrequest into async? i mean task* ...nvm, i see it now lol. well yeah true, i guess it was hard to write Task.Run"

image

idk bc im not a coder, but i have seen a lot of the big servers refuse to use your mod, and apparently this above is the reason. me personally i love the functionality of the mod and it works great for me, but i have good hardware, superb internet, and only maybe 25 players so i never run into this issue. but sometimes people DC when connected to my server so who knows. anyyway, maybe you can look into it and decide if its a problem. i hope this is well received, im only sharing what i read because id like to see your mod be the best it can be. thx for all the hard work you put in, its very much appreciated.

sry if maybe i shoulda put this in a separate thread...

@nwesterhausen
Copy link
Owner

Yeah I'll make a new issue for making the request async. I appreciate you sharing, I wouldn't have heard about it otherwise... even though anyone can open an issue or make a pull request for this mod.

@nwesterhausen
Copy link
Owner

In release 1.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants