Guilds icon indicating copy to clipboard operation
Guilds copied to clipboard

Prevent use of formats in guild name and prefix

Open SrBedrock opened this issue 6 years ago • 6 comments

Context

I think it's important because using format code in the name or prefix makes chat a mess.

Codes: &m &l &n &o &r

Possible Implementation

Through ReGex or config?

guild:
    requirements:
        # With the default RegEx currently set, the minimum length of the prefix is 1 and the maximum is 64.
        # To change this, adjust the number and you can refer to the link below on how to modify RegEx.
        # RegEx (https://en.wikipedia.org/wiki/Regular_expression) used to only allow certain characters (default only allows alphanumeric characters).
        # To turn off the ability to use colors, remove the & from the RegEx.
        # Trying to use symbols such as Chinese ones? Try this Regex: [\u4E00-\u9FA5_a-zA-Z0-9&_\一-龥]{1,6}
        name: '[a-zA-Z0-9&]{1,64}'
        # Similar to the name, just refer above.
        prefix: '[a-zA-Z0-9&]{3,3}'
        # Would you like to include color codes signs (&b &l, etc) in the length check?
        include-color-codes: false
        allow-format-codes: false

SrBedrock avatar Nov 06 '19 19:11 SrBedrock

One way to decide which format code type would be a good choice.

SrBedrock avatar Nov 06 '19 19:11 SrBedrock

Regex doesn't exactly work that way, but...

~~Glare could probably create a blacklist and people can blacklist the &m &l &n &o &r codes. That might be a good solution.~~

Wait doesn't a blacklist already exist...

blacklist:
        # Do we want to enable the blacklist?
        enabled: true
        # Do we want the blacklist to be case sensitive?
        case-sensitive: true
        # What words would you like to blacklist from being used?
        words: 
        - &m 
        - &l 
        - &n 
        - &o 
        - &r

@SrBedrock would you mind testing adding the &m &l &n &o &r codes to the blacklist and see if that prevents them from using formatting codes?

wolfebersahd avatar Nov 06 '19 19:11 wolfebersahd

I thought about this option, I will try and warn you here!

SrBedrock avatar Nov 06 '19 19:11 SrBedrock

Did not work @wolfebersahd .

SrBedrock avatar Nov 06 '19 19:11 SrBedrock

@SrBedrock, would you mind testing with

        include-color-codes: true

just a random thought.

wolfebersahd avatar Nov 06 '19 19:11 wolfebersahd

I think it would work but it would disrupt the current system, as seen in config.yml

SrBedrock avatar Nov 06 '19 20:11 SrBedrock