Skip to content

Commit 3b1d987

Browse files
committed
Fix for Webhooks Chat Relay
1 parent 808867e commit 3b1d987

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Si_Webhooks/Si_Webhooks.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ You should have received a copy of the GNU General Public License
3737
using System.Collections.Generic;
3838
using Newtonsoft.Json;
3939

40-
[assembly: MelonInfo(typeof(Webhooks), "Webhooks", "1.2.4", "databomb", "https://github.com/data-bomb/Silica")]
40+
[assembly: MelonInfo(typeof(Webhooks), "Webhooks", "1.2.5", "databomb", "https://github.com/data-bomb/Silica")]
4141
[assembly: MelonGame("Bohemia Interactive", "Silica")]
4242
[assembly: MelonOptionalDependencies("Admin Mod")]
4343

@@ -167,6 +167,7 @@ public static void Postfix(Silica.UI.Chat __instance, Player __0, string __1, bo
167167
{
168168
avatarURL = _Default_Avatar_URL.Value;
169169
}
170+
170171
SendMessageToWebhook(rawMessage, username, avatarURL, isUserReport);
171172
}
172173
catch (Exception error)
@@ -183,6 +184,11 @@ static void SendMessageToWebhook(string message, string username, string avatar,
183184
return;
184185
}
185186

187+
if (!SteamAPI.IsSteamRunning())
188+
{
189+
SteamAPI.Init();
190+
}
191+
186192
HTTPRequestHandle request = SteamHTTP.CreateHTTPRequest(EHTTPMethod.k_EHTTPMethodPOST, _Webhooks_URL.Value);
187193
string payload = "{\"content\": \"" + message + "\", \"username\": \"" + username + "\", \"avatar_url\": \"" + avatar + "\", \"allowed_mentions\": { \"parse\": [] } }";
188194

0 commit comments

Comments
 (0)