aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/hooks/wa.rs16
-rw-r--r--src/main.rs5
2 files changed, 21 insertions, 0 deletions
diff --git a/src/hooks/wa.rs b/src/hooks/wa.rs
index 7d087ea..e51aa47 100644
--- a/src/hooks/wa.rs
+++ b/src/hooks/wa.rs
@@ -1,9 +1,11 @@
use crate::util::web::shorten_url;
use anyhow::{Context, Error, Result};
use futures::try_join;
+use irc::client::prelude::*;
use reqwest::{get, Url};
use serde::{Deserialize, Serialize};
use serde_json::Result as SerdeJsonResult;
+use macros::privmsg;
#[derive(Serialize, Deserialize, Debug)]
struct WaResponse {
@@ -103,6 +105,20 @@ async fn wa_query(query_str: &str, base_url: Option<&str>) -> Result<String, Err
))
}
+pub async fn wa(bot: &crate::Bot, msg: Message) -> Result<()> {
+ privmsg!(msg, {
+ let mut chars = text.chars();
+ chars.next();
+ chars.next_back();
+ let content = chars.as_str();
+
+ bot.send_privmsg(
+ msg.response_target().context("failed to get response target")?,
+ &wa_query(content, None).await?
+ )?;
+ })
+}
+
#[cfg(test)]
mod tests {
diff --git a/src/main.rs b/src/main.rs
index 9ab7f6c..f337613 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -52,5 +52,10 @@ async fn main() {
"Prints some info about this kitty cat",
catinator::hooks::about
),
+ async command(
+ "wa",
+ "Returns Wolfram Alpha results for a query",
+ catinator::hooks::wa::wa
+ ),
];
}
>add audron windows wg keyMax Audron-0/+8 2025-09-02switch out vultr dns ipv4 ipMax Audron-1/+5 2025-08-11disable homepage trackersMax Audron-3/+3 2025-08-11add mail serverMax Audron-1/+245 2025-08-05add prometheus alerting rulesMax Audron-38/+144 2025-08-01add homepage dashboardMax Audron-3/+284 2025-08-01disable not used gameserversMax Audron-1/+2 2025-08-01add minecraft prometheus exporterMax Audron-3/+67 2025-08-01more monitoring & scrape config shortcutsMax Audron-68/+63 2025-08-01update garage to 2.0Max Audron-6/+10 2025-07-31fix authentik-ldap port bindingsMax Audron-0/+5 2025-07-31update to nixos 25.05Max Audron-113/+65 2025-07-31add more monitoring exporters and scrapersMax Audron-17/+57 2025-07-30try to run authentik nativelyMax Audron-26/+303 2025-07-30more metricsMax Audron-1/+41 2025-07-30enable firewallsMax Audron-1/+39