feat: Add configurable join/leave templates and role-based /smite command#447
Open
AhmedMoustafaa wants to merge 1 commit intoshazow:masterfrom
Open
feat: Add configurable join/leave templates and role-based /smite command#447AhmedMoustafaa wants to merge 1 commit intoshazow:masterfrom
AhmedMoustafaa wants to merge 1 commit intoshazow:masterfrom
Conversation
Owner
|
Hi Ahmed, appreciate you messing around with the codebase but ssh-chat v1 is currently in maintenance mode, so I won't be merging new features in this branch. But if you'd like to maintain a fork with additional feature, I'd love to link to it! |
Author
Thanks for the context, Shazow! Totally understood. I'll keep the fork going and clean it up properly. Would love to have it linked here. Appreciate you taking the time to look at it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces three new CLI flags to allow server administrators to customize the user experience and generalizes the
/smitecommand to work for any designated operator.Changes
--op-hubris: Enables a specialized bold/yellow prefix for Operator join and leave events.--announce-join: Allows custom string templates for join messages (e.g., "Mortal %s has entered."). Defaults to the original%s joined..--announce-leave: Allows custom string templates for leave messages. Defaults to the original%s left..isOpvalidation, allowing any admin (defined via--admin) to utilize the smite functionality.Memberstruct inchat/room.goto fully implement theset.Iteminterface by addingKey() stringandValue() interface{}methods.Technical Details
The implementation uses
fmt.Sprintfto inject the username into the provided templates. By providing default values in theOptionsstruct, this change is fully backwards compatible; existing users will see no change in behavior unless they explicitly use the new flags.Why this is useful
Different communities (gaming, technical, or private teams) often want to theme their chat servers. These flags allow for complete branding and "flavor" of the server announcements without requiring a custom fork or hardcoding strings into the binary.
Note: Compiled and tested on Ubuntu with Go 1.20+. Compliance with the
setlibrary interface has been verified to prevent runtime panics.