diff --git a/kokkoro/bot/discord/discord_util.py b/kokkoro/bot/discord/discord_util.py index a7b0f10..bc29d06 100644 --- a/kokkoro/bot/discord/discord_util.py +++ b/kokkoro/bot/discord/discord_util.py @@ -12,7 +12,7 @@ def remove_mention_me(raw_message) -> (str, bool): return raw_message.replace(MENTION_BOT, "").strip(), True return raw_message, False -dc_at_pattern = r'<@![a-z0-9A-Z]+>' +dc_at_pattern = r'<@!?[a-z0-9A-Z]+>' def normalize_message(raw_message: str) -> str: """ 规范化 at 信息,"<@!123> waht<@!312>a12" => "@123 waht @312 a12" @@ -26,4 +26,7 @@ def normalize_at(raw_at): """ 规范化 at 信息,"<@!123>" => " @123 " """ - return f' @{raw_at[3:-1]} ' \ No newline at end of file + if '!' in raw_at: + return f' @{raw_at[3:-1]} ' + else: + return f' @{raw_at[2:-1]} '