private void MessageRecieved(TorchChatMessage msg, ref bool consumed) { try { if (!Config.Enabled) { return; } if (msg.AuthorSteamId != null && !ChatManager.MutedUsers.Contains((ulong)msg.AuthorSteamId)) { if (DEBUG) { Log.Info($"Recieved messages with valid SID {msg.Author} | {msg.Message} | {msg.Target} | {msg.AuthorSteamId}"); } switch (msg.Channel) { case ChatChannel.Global: DDBridge.RunSendChatTask(msg.Author, msg.Message); break; case ChatChannel.GlobalScripted: DDBridge.RunSendChatTask(msg.Author, msg.Message); break; case ChatChannel.Faction: if (msg.AuthorSteamId.ToString().StartsWith("7")) { IMyFaction fac = MySession.Static.Factions.TryGetFactionById(msg.Target); DDBridge.RunSendFacTask(msg.Author, msg.Message, fac.Name); } break; } } else if (Config.ServerToDiscord && msg.Channel.Equals(ChatChannel.Global) && !msg.Message.StartsWith(Config.CommandPrefix) && msg.Target.Equals(0)) { if (DEBUG) { Log.Info($"Recieved messages with no SID {msg.Author} | {msg.Message} | {msg.Target}"); } DDBridge.RunSendChatTask(msg.Author, msg.Message); } } catch (Exception e) { Log.Fatal(e); } }