Skip to content

Commit

Permalink
Added test for markdown v2
Browse files Browse the repository at this point in the history
  • Loading branch information
tapnisu committed Mar 16, 2024
1 parent 4611635 commit e47b191
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pub mod cli;
pub mod config;
pub mod handler;
pub mod utils;

pub use cli::Cli;
pub use config::{parse_config, Config};
pub use handler::Handler;
pub use utils::{format_embed, format_message, EscapeMarkdownV2};
9 changes: 1 addition & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
mod cli;
mod config;
mod handler;
mod utils;

use clap::{error::ErrorKind, CommandFactory, Parser};
use cli::Cli;
use config::parse_config;
use handler::Handler;
use dsc_tg_forwarder::{cli::Cli, config::parse_config, handler::Handler};
use serenity::prelude::*;
use std::env;
use teloxide::prelude::*;
Expand Down
11 changes: 10 additions & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ use serenity::{
prelude::Context,
};

trait EscapeMarkdownV2 {
pub trait EscapeMarkdownV2 {
/// Escapes Telegrams Markdown V2 characters
///
/// ```
/// use dsc_tg_forwarder::EscapeMarkdownV2;
///
/// let result = "*Hello world!*".to_owned().escape_markdown_v2();
///
/// assert_eq!(result, "\\*Hello world\\!\\*".to_owned());
/// ```
fn escape_markdown_v2(&self) -> String;
}

Expand Down

0 comments on commit e47b191

Please sign in to comment.