From 29490ace7e9c1baf85b0389b751f578a57c0a19f Mon Sep 17 00:00:00 2001 From: Dmitriy <108795395+Sh1ntra@users.noreply.github.com> Date: Fri, 1 Nov 2024 02:20:14 +0300 Subject: [PATCH] Ahelpfix (#109) * fix ahelp system for logging * fix ahelp system v2 * try fix ahelp v3 * fixed ahelp sys * try fix ahelp --- .../Administration/Systems/BwoinkSystem.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Content.Server/Administration/Systems/BwoinkSystem.cs b/Content.Server/Administration/Systems/BwoinkSystem.cs index 11ff2eadf7..bb179cb59e 100644 --- a/Content.Server/Administration/Systems/BwoinkSystem.cs +++ b/Content.Server/Administration/Systems/BwoinkSystem.cs @@ -456,6 +456,30 @@ protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySes RaiseNetworkEvent(msg, session.Channel); } } + var sendsWebhook = _webhookUrl != string.Empty; + if (sendsWebhook) + { + if (!_messageQueues.ContainsKey(msg.UserId)) + _messageQueues[msg.UserId] = new Queue(); + + var str = message.Text; + var unameLength = senderSession.Name.Length; + + if (unameLength + str.Length + _maxAdditionalChars > DescriptionMax) + { + str = str[..(DescriptionMax - _maxAdditionalChars - unameLength)]; + } + var nonAfkAdmins = GetNonAfkAdmins(); + _messageQueues[msg.UserId].Enqueue(GenerateAHelpMessage(senderSession.Name, str, !personalChannel, _gameTicker.RoundDuration().ToString("hh\\:mm\\:ss"), _gameTicker.RunLevel, playedSound: playSound, noReceivers: nonAfkAdmins.Count == 0)); + } + + if (admins.Count != 0 || sendsWebhook) + return; + + // No admin online, let the player know + var systemText = Loc.GetString("bwoink-system-starmute-message-no-other-users"); + var starMuteMsg = new BwoinkTextMessage(message.UserId, SystemUserId, systemText); + RaiseNetworkEvent(starMuteMsg, senderSession.Channel); } private IList GetNonAfkAdmins()