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

added functionality for string.gsub in invitation whisper #42

Merged
merged 2 commits into from
Feb 12, 2025

Conversation

ronniedude
Copy link
Contributor

@ronniedude ronniedude commented Feb 5, 2025

I wanted to have an invitation message that advocates for the use of inverse phrases in the /layer channel something akin to this:

Inviting you to layer 1. If you are UNHAPPY with this layer, decline my invite and type in /layer channel like "layer not 1"

*where 1 is my current layer

string.format doesn't natively allow you to use multiple %s values in the string so I created a helper function to also allow the use of string.gsub to look for the characters: {layer}.

This allows you to use the layer number multiple times in a whisper.

The helper also still checks the string for a %s and will apply a string.format if found. This maintains current compatibility with today's users' current saved template strings

I wanted to have an invitation message that advocates for the use of inverse phrases in the /layer channel something akin to this:

Inviting you to layer 1. If you are UNHAPPY with this layer, decline my invite and type in /layer channel like "layer not 1"

strong.format doesn't natively allow you to use multiple %s values in the string so I created a helper function to also allow the use of string.gsub to look for the characters: {layer}.

This allows you to use the layer number multiple times in a whisper.
@iraizo iraizo self-assigned this Feb 6, 2025
Goes alongside my other commit regarding using gsub for layer value string subsitution.

I've seen 9 layers on Doomhowl (US) server before so 10+ layers could be possible. so the validation layer value assumes a 2 digit length for safety
@iraizo iraizo merged commit e82775f into iraizo:master Feb 12, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants