add +gemini

This commit is contained in:
Elijah R 2024-04-03 20:46:54 -04:00
parent ef1d27e79e
commit ddd98b32ee

View file

@ -33,6 +33,19 @@ public class VM
this.cvm.UserRenamed += (_, e) => CheckUsername(e.User); this.cvm.UserRenamed += (_, e) => CheckUsername(e.User);
this.cvm.UserJoined += (_, e) => CheckUsername(e); this.cvm.UserJoined += (_, e) => CheckUsername(e);
this.cvm.RegisterCommand("+quote", QuoteCommand); this.cvm.RegisterCommand("+quote", QuoteCommand);
this.cvm.RegisterCommand("+gemini", Gemini);
}
private async void Gemini(string username, string prompt)
{
var http = new HttpClient();
var response = await http.GetStringAsync("https://mail.elijahr.dev/gemini.php?cvm=1&q=" + Uri.EscapeDataString(prompt));
var outs = response.Split('\n');
foreach (var line in outs)
{
if (string.IsNullOrEmpty(line)) continue;
await cvm.SendXSSChat(WebUtility.HtmlEncode(line));
}
} }
private async void QuoteCommand(string username, string[] args) private async void QuoteCommand(string username, string[] args)