forked from karx/dircord
Fix pinging unknown users
This commit is contained in:
parent
722eb46756
commit
f5705ed296
|
@ -272,6 +272,7 @@ async fn discord_to_irc_processing(
|
||||||
regex! {
|
regex! {
|
||||||
static PING_RE_1 = r"<@([0-9]+)>";
|
static PING_RE_1 = r"<@([0-9]+)>";
|
||||||
static PING_RE_2 = 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 EMOJI_RE = r"<:(\w+):[0-9]+>";
|
||||||
static CHANNEL_RE = r"<#([0-9]+)>";
|
static CHANNEL_RE = r"<#([0-9]+)>";
|
||||||
static ROLE_RE = r"<@&([0-9]+)>";
|
static ROLE_RE = r"<@&([0-9]+)>";
|
||||||
|
@ -317,6 +318,9 @@ async fn discord_to_irc_processing(
|
||||||
)
|
)
|
||||||
.into_owned();
|
.into_owned();
|
||||||
|
|
||||||
|
// switch brackets of unknown pings
|
||||||
|
computed = PING_RE_1.replace_all(&computed, "{@$1}").into_owned();
|
||||||
|
|
||||||
computed = {
|
computed = {
|
||||||
#[allow(clippy::enum_glob_use)]
|
#[allow(clippy::enum_glob_use)]
|
||||||
use pulldown_cmark::{Event::*, Tag::*};
|
use pulldown_cmark::{Event::*, Tag::*};
|
||||||
|
@ -380,5 +384,8 @@ async fn discord_to_irc_processing(
|
||||||
new
|
new
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// switch them back
|
||||||
|
computed = PING_RE_3.replace_all(&computed, "<@$1>").into_owned();
|
||||||
|
|
||||||
computed
|
computed
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue