From 87ad83f473ebc3579477030e9a06f2bca1bb3dfe Mon Sep 17 00:00:00 2001 From: Guillermo Roche Date: Sun, 11 May 2025 21:40:41 +0200 Subject: [PATCH] add version command and more tests --- polesDB | Bin 20480 -> 20480 bytes src/lib.rs | 3 +++ src/rewrite_links/links_to_rewrite.rs | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/polesDB b/polesDB index 260056f6f3e73fc2c6dce1355d51e330537361c6..c6ab94872a56fb28c6473b272220a1dd8530d86a 100644 GIT binary patch delta 77 zcmZozz}T>Wae_1>&qNt#MxKocQSywOn|I5*2ne$9GB7Z(@W(LlU*})P-^w4eSx~@- hUr3#WO;J;pk-^Bo$W+(BRM*gO@&S8^&29Eo0szRE5)c3Y delta 52 zcmZozz}T>Wae_1>*F+g-My`zsQSyvzn|I5*2=FuWGB7YO^S3haU*})P-?~{)pqzhm It9`Wq0BG6`uK)l5 diff --git a/src/lib.rs b/src/lib.rs index cb8295d..7fe3592 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,6 +24,8 @@ enum Command { Top, #[command(description = "get the server time")] Time, + #[command(description = "get the bot version")] + Version, } /*#[tokio::main] @@ -117,6 +119,7 @@ async fn answer(bot: Bot, msg: Message, command: Command) -> anyhow::Result<()> ) .await? } + Command::Version => bot.send_message(msg.chat.id, "0.2.5").await?, }; Ok(()) diff --git a/src/rewrite_links/links_to_rewrite.rs b/src/rewrite_links/links_to_rewrite.rs index ab0341a..39ddb2a 100644 --- a/src/rewrite_links/links_to_rewrite.rs +++ b/src/rewrite_links/links_to_rewrite.rs @@ -94,3 +94,14 @@ fn test_rewrite_refered_tiktok() { Some("https://vxtiktok.com/@/video/7417808362957589778".to_string()) ); } + +#[test] +fn test_rewrite_refered_instagram() { + let url_and_domain = + get_domain_from_text("https://www.instagram.com/reel/DJAE4JXSvHn/".to_string()); + let domain = filter_string(url_and_domain.0, url_and_domain.1); + assert_eq!( + domain, + Some("https://ddinstagram.com/reel/DJAE4JXSvHn/".to_string()) + ); +}