Skip to content

Commit

Permalink
feat: mention when pinging @ALL
Browse files Browse the repository at this point in the history
  • Loading branch information
gounux committed Jul 26, 2024
1 parent 147de86 commit 4078135
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions qtribu/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]
8 changes: 7 additions & 1 deletion qtribu/gui/dck_qchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
CHEATCODE_DONTCRYBABY,
CHEATCODE_IAMAROBOT,
CHEATCODE_QGIS_PRO_LICENSE,
CHEATCODES,
INTERNAL_MESSAGE_AUTHOR,
QCHAT_NICKNAME_MINLENGTH,
)
Expand Down Expand Up @@ -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"],
Expand Down

0 comments on commit 4078135

Please sign in to comment.