private static void InitAllCommands() { List <DefaultCommand> defaultCommands = AssistantDb.Instance.DefaultCommands.GetAll().ToList(); foreach (var command in defaultCommands) { DefaultBotCommand newCommand = new DefaultBotCommand(command); newCommand.SetNewAction(DefaultCommandsFunctional.Actions[command.Action]); DefaultCommandsList.Add(newCommand); } List <PlayerCommand> playerCommands = AssistantDb.Instance.PlayerCommands.GetAll().ToList(); foreach (var command in playerCommands) { PlayerBotCommand newCommand = new PlayerBotCommand(command); newCommand.SetNewAction(PlayerCommandsFunctional.Actions[command.Action]); PlayerCommandsList.Add(newCommand); } List <CustomCommand> customCoommands = AssistantDb.Instance.CustomCommands.GetAll().ToList(); foreach (var command in customCoommands) { CustomBotCommand newCommand = new CustomBotCommand(command); newCommand.SetNewAction(CustomCommandsFunctional.Actions[command.Action]); newCommand.ResponseMessage = command.ResponseMessage; CustomCommandsList.Add(newCommand); } }
private void AddCommand() { int newCommandId = Guid.NewGuid().GetHashCode(); CustomBotCommand command = new CustomBotCommand() { Id = newCommandId, Name = "Command", IsMessage = true, IsWhisp = false, IsEnabled = true, Description = "You command description", IsUserLevelErrorResponse = true, UserLevel = TwitchRangs.Unfollower, GlobalCooldown = new TimeSpan(0, 0, 5), IsGlobalCooldown = false, IsGlobalErrorResponse = false, IsWhispErrors = false, IsChatErrors = false, ActionName = "SendCustomCommandMessage", ResponseMessage = "You message" }; command.SetNewAction(CustomCommandsFunctional.Actions[command.ActionName]); Commands.Add(command); }