public static Response MarkovCommand() { WherePredicate logProtocol = new WherePredicate() { Source = "protocol", Comparitor = "= ANY", Target = new[] { "Twitch", "Discord" } }; WherePredicate logChannels = new WherePredicate() { Source = "channel_id", Comparitor = "= ANY", Target = new[] { 0, 214268737887404042 } }; WherePredicate excludeKuma = new WherePredicate() { Source = "username", Comparitor = "<>", Target = "KumaKaiNi" }; WherePredicate excludeCommands = new WherePredicate() { Source = "message", Comparitor = "NOT LIKE", Target = "!%" }; WherePredicate excludeLinks = new WherePredicate() { Source = "message", Comparitor = "!~*", Target = @".*((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?).*" }; List <Log> logs = Database.GetMany <Log>(new[] { logProtocol, logChannels, excludeKuma, excludeCommands, excludeLinks }, 1000); string[] lines = new string[logs.Count]; for (int i = 0; i < logs.Count; i++) { lines[i] = logs[i].Message; } string markovResponse = GetMarkovResponse(lines); return(new Response(markovResponse)); }
public static Response GptResponse() { WherePredicate unsaidResponses = new WherePredicate() { Source = "returned", Comparitor = "=", Target = false }; List <GptResponse> results = Database.GetMany <GptResponse>(new[] { unsaidResponses }, 1, true); if (results.Count == 0) { return(new Response("I have nothing more to say...")); } GptResponse gpt = results[0]; gpt.Returned = true; gpt.Update(); return(new Response(gpt.Message)); }