public static void CheckCommand(TwitchIRCMessage msg) { if (msg == null) { return; } if (msg.Message == null) { return; } Viewer viewer = msg.Viewer; viewer.WasSeen(); if (viewer.IsBanned) { return; } if (!msg.Message.StartsWith("!")) { IRCMessageLog.AddNewMessage(msg); } Command commandDef = DefDatabase <Command> .AllDefs.ToList().Find(s => msg.Message.StartsWith("!" + s.command)); if (commandDef != null) { bool runCommand = true; if (commandDef.requiresMod && (!viewer.Mod && viewer.UsernameLower != ToolkitSettings.Channel.ToLower())) { runCommand = false; } if (commandDef.requiresAdmin && msg.User.ToLower() != ToolkitSettings.Channel.ToLower()) { runCommand = false; } if (!commandDef.enabled) { runCommand = false; } if (commandDef.shouldBeInSeparateRoom && !AllowCommand(msg)) { runCommand = false; } if (runCommand) { commandDef.RunCommand(msg); } } List <TwitchInterfaceBase> modExtensions = Current.Game.components.OfType <TwitchInterfaceBase>().ToList(); if (modExtensions == null) { return; } foreach (TwitchInterfaceBase parser in modExtensions) { parser.ParseCommand(msg); } }
static void ChatMessageReadout() { IRCMessageLog.IRCMessageReadoutOnGUI(); }