protected override CommandResponseHandler reallyRun(User source, string channel, string[] args) { if (!AccessLog.instance().save(new AccessLog.AccessLogEntry(source, GetType(), true, channel, args))) { CommandResponseHandler errorResponse = new CommandResponseHandler(); errorResponse.respond("Error adding to access log - command aborted.", CommandResponseDestination.ChannelDebug); errorResponse.respond(new Message().get("AccessDeniedAccessListFailure"), CommandResponseDestination.Default); return(errorResponse); } this.log("Starting command execution..."); CommandResponseHandler crh; try { crh = GlobalFunctions.isInArray("@confirm", args) != -1 ? execute(source, channel, args) : notConfirmed(source, channel, args); } catch (Exception ex) { Logger.instance().addToLog(ex.ToString(), Logger.LogTypes.Error); crh = new CommandResponseHandler(ex.Message); } this.log("Command execution complete."); return(crh); }
/// <summary> /// Access denied to command, decide what to do /// </summary> /// <param name="source">The source of the command.</param> /// <param name="channel">The channel the command was triggered in.</param> /// <param name="args">The arguments to the command.</param> /// <returns>A response to the command if access to the command was denied</returns> protected virtual CommandResponseHandler accessDenied(User source, string channel, string[] args) { CommandResponseHandler response = new CommandResponseHandler(); response.respond(new Message().get("accessDenied", ""), CommandResponseDestination.PrivateMessage); this.log("Access denied to command."); if (!AccessLog.instance().save(new AccessLog.AccessLogEntry(source, GetType(), false, channel, args))) { response.respond("Error adding denied entry to access log.", CommandResponseDestination.ChannelDebug); } return(response); }