public ReminderService(JsonConstructor builder, IGetDateFromString getDate, IEmbedHelper embed, DiscordSocketClient client, TimerHelper timer) { _getDate = getDate; _builder = builder; _embed = embed; _client = client; _timer = timer; _client.LoggedIn += TimerStarter; }
public String ShellAction(String command) { if (RunProcess.Run(command)) { return(JsonConstructor.SendMessage(true, "成功")); } else { return(JsonConstructor.SendMessage(false, "脚本不存在或执行失败")); } }
public String SystemAction(String command) { if (RunSystemAction.Run(command)) { return(JsonConstructor.SendMessage(true, "成功")); } else { return(JsonConstructor.SendMessage(false, "命令不存在")); } }
public String Analyze(String actionParm, String commandParm, String secret_keyParm) { //参数验证 if (Properties.Settings.Default.secret_key) { if (actionParm == null || commandParm == null || secret_keyParm == null) { return(JsonConstructor.SendMessage(false, "必要参数无效")); } if (secret_keyParm != Properties.Settings.Default.secret_key_str) { return(JsonConstructor.SendMessage(false, "密钥错误")); } } else { if (actionParm == null || commandParm == null) { return(JsonConstructor.SendMessage(false, "必要参数无效!")); } } //分参数执行 if (actionParm == "System" || actionParm == "system") { return(action.SystemAction(commandParm)); } else if (actionParm == "Shell" || actionParm == "shell") { return(action.ShellAction(commandParm)); } else { return(JsonConstructor.SendMessage(false, "action参数错误:" + actionParm)); } }