Fix pinging unknown users

This commit is contained in:
Yash Karandikar 2023-04-25 14:12:37 -05:00
parent 722eb46756
commit f5705ed296

View file

@ -272,6 +272,7 @@ async fn discord_to_irc_processing(
regex! {
static PING_RE_1 = r"<@([0-9]+)>";
static PING_RE_2 = r"<@!([0-9]+)>";
static PING_RE_3 = r"\{@([0-9]+)\}";
static EMOJI_RE = r"<:(\w+):[0-9]+>";
static CHANNEL_RE = r"<#([0-9]+)>";
static ROLE_RE = r"<@&([0-9]+)>";
@ -317,6 +318,9 @@ async fn discord_to_irc_processing(
)
.into_owned();
// switch brackets of unknown pings
computed = PING_RE_1.replace_all(&computed, "{@$1}").into_owned();
computed = {
#[allow(clippy::enum_glob_use)]
use pulldown_cmark::{Event::*, Tag::*};
@ -380,5 +384,8 @@ async fn discord_to_irc_processing(
new
};
// switch them back
computed = PING_RE_3.replace_all(&computed, "<@$1>").into_owned();
computed
}