From ae67170e855e95b412176ca15bae9610a184374c Mon Sep 17 00:00:00 2001 From: stifskere Date: Fri, 2 Aug 2024 02:56:32 +0200 Subject: [PATCH 1/2] fix --- Cargo.lock | 9 +++++---- Cargo.toml | 1 + src/events/read_github_links.rs | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dd8446c..3c5d0c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -370,6 +370,7 @@ dependencies = [ "shuttle-runtime", "songbird", "symphonia", + "time", "tokio", "tracing", "urlencoding", @@ -3487,9 +3488,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", @@ -3508,9 +3509,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", diff --git a/Cargo.toml b/Cargo.toml index 8f2fcab..b339814 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,6 +50,7 @@ once_cell = "1.18.0" gen_welcome = { version = "0.1.0", path = "crates/gen_welcome" } urlencoding = "2.1.3" lazy_static = "1.4.0" +time = "0.3.36" [dependencies.parking_lot] version = "0.12" diff --git a/src/events/read_github_links.rs b/src/events/read_github_links.rs index bfebea0..ec4139a 100644 --- a/src/events/read_github_links.rs +++ b/src/events/read_github_links.rs @@ -166,6 +166,10 @@ async fn read_message(link: String) -> Option { #[async_trait] impl EventHandler for ReadGithubLinkHandler { async fn message(&self, ctx: Context, msg: Message) { + if msg.author.bot { + return; + } + let repo_regex = Regex::new(r"(https://github\.com/(?:[^/]+/){2})blob/(.*)") .unwrap(); From 51d89ba86743f459689085a230f77d2b94a77b4b Mon Sep 17 00:00:00 2001 From: stifskere Date: Fri, 2 Aug 2024 02:58:33 +0200 Subject: [PATCH 2/2] noembed --- src/events/read_github_links.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/events/read_github_links.rs b/src/events/read_github_links.rs index ec4139a..7dbce60 100644 --- a/src/events/read_github_links.rs +++ b/src/events/read_github_links.rs @@ -166,7 +166,7 @@ async fn read_message(link: String) -> Option { #[async_trait] impl EventHandler for ReadGithubLinkHandler { async fn message(&self, ctx: Context, msg: Message) { - if msg.author.bot { + if msg.author.bot || msg.content.starts_with("noembed") { return; }