Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support full capitalization in GMCP commands #3521

Merged
merged 1 commit into from
Apr 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions evennia/server/portal/telnet_oob.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,8 @@ def encode_gmcp(self, cmdname, *args, **kwargs):
if cmdname in EVENNIA_TO_GMCP:
gmcp_cmdname = EVENNIA_TO_GMCP[cmdname]
elif "_" in cmdname:
if cmdname.istitle():
# leave without capitalization
gmcp_cmdname = ".".join(word for word in cmdname.split("_"))
else:
gmcp_cmdname = ".".join(word.capitalize() for word in cmdname.split("_"))
# enforce initial capitalization of each command part, leaving fully-capitalized sections intact
gmcp_cmdname = ".".join(word.capitalize() if not word.isupper() else word for word in cmdname.split("_"))
else:
gmcp_cmdname = "Core.%s" % (cmdname if cmdname.istitle() else cmdname.capitalize())

Expand Down