Fix punctuation match order and add tests
[mudpy.git] / lib / mudpy / misc.py
index 0843586..ea18ffb 100644 (file)
@@ -2043,7 +2043,9 @@ def command_say(actor, parameters):
             universe.categories["internal"]["language"].get(
                 "default_punctuation"))
         action = ""
-        for mark in actions.keys():
+
+        # reverse sort punctuation options so the longest match wins
+        for mark in sorted(actions.keys(), reverse=True):
             if not literal and message.endswith(mark):
                 action = actions[mark]
                 break