diff --git a/qtribu/constants.py b/qtribu/constants.py index 0a476a2a..773b0f1c 100644 --- a/qtribu/constants.py +++ b/qtribu/constants.py @@ -204,3 +204,11 @@ def local_path(self, base_path: Path = Path().home() / ".geotribu/cdn/") -> Path CHEATCODE_IAMAROBOT = "iamarobot" CHEATCODE_10OCLOCK = "its10oclock" CHEATCODE_QGIS_PRO_LICENSE = "qgisprolicense" + +CHEATCODES = [ + CHEATCODE_DIZZY, + CHEATCODE_DONTCRYBABY, + CHEATCODE_IAMAROBOT, + CHEATCODE_10OCLOCK, + CHEATCODE_QGIS_PRO_LICENSE, +] diff --git a/qtribu/gui/dck_qchat.py b/qtribu/gui/dck_qchat.py index 658608b1..34e0022d 100644 --- a/qtribu/gui/dck_qchat.py +++ b/qtribu/gui/dck_qchat.py @@ -23,6 +23,7 @@ CHEATCODE_DONTCRYBABY, CHEATCODE_IAMAROBOT, CHEATCODE_QGIS_PRO_LICENSE, + CHEATCODES, INTERNAL_MESSAGE_AUTHOR, QCHAT_NICKNAME_MINLENGTH, ) @@ -352,8 +353,13 @@ def on_ws_message_received(self, message: str) -> None: if activated: return + # do not display cheatcodes + if message["message"] in CHEATCODES: + return + # check if message mentions current user - if f"@{self.settings.author_nickname}" in message["message"]: + words = message["message"].split(" ") + if f"@{self.settings.author_nickname}" in words or "@all" in words: item = self.create_message_item( self.current_room, message["author"],