I get notified by halflife with @Martijn Pieters, with a space, so other @Martijn's in a room would get the same notification. Display names should really be normalized.
Chat notifications use the same rules as @comment reply notifications, so this post by Atwood should apply. Remove everything other than the regex.
This should suffice:
import re
def at_notification_name(username, _sub=re.compile(r"[^\w'.-]*").sub):
"""Produce the @DisplayName notification normazilation form"""
return "@" + _sub('', username)
I get notified by halflife with
@Martijn Pieters
, with a space, so other@Martijn
's in a room would get the same notification. Display names should really be normalized.Chat notifications use the same rules as
@comment
reply notifications, so this post by Atwood should apply. Remove everything other than the regex.This should suffice:
then use this function when generating notifications: