mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-10 13:18:54 -05:00
[V3 Alias] Allow wider range of aliases (#1201)
* [V3 Alias] Allow wider range of aliases Possible fix for #1118 Makes it so that the only non-valid names are the ones that can't be printed by something. * [V3 Alias] Edit Check & Error Message Reflects the wider range of aliases that can be created. * [V3 Alias] Fix wrong slash in regex * [V3 Alias] Fix Wrong Closing Parenthesis Position Can't believe I'm messing it up
This commit is contained in:
parent
73c08da037
commit
eb10508c5f
@ -1,4 +1,5 @@
|
||||
from copy import copy
|
||||
from re import search
|
||||
from typing import Generator, Tuple, Iterable
|
||||
|
||||
import discord
|
||||
@ -75,7 +76,7 @@ class Alias:
|
||||
|
||||
@staticmethod
|
||||
def is_valid_alias_name(alias_name: str) -> bool:
|
||||
return alias_name.isidentifier()
|
||||
return not bool(search(r'\s', alias_name)) and alias_name.isprintable()
|
||||
|
||||
async def add_alias(self, ctx: commands.Context, alias_name: str,
|
||||
command: Tuple[str], global_: bool=False) -> AliasEntry:
|
||||
@ -211,8 +212,7 @@ class Alias:
|
||||
await ctx.send(_("You attempted to create a new alias"
|
||||
" with the name {} but that"
|
||||
" name is an invalid alias name. Alias"
|
||||
" names may only contain letters, numbers,"
|
||||
" and underscores and must start with a letter.").format(alias_name))
|
||||
" names may not contain spaces.").format(alias_name))
|
||||
return
|
||||
# endregion
|
||||
|
||||
@ -250,8 +250,7 @@ class Alias:
|
||||
await ctx.send(_("You attempted to create a new global alias"
|
||||
" with the name {} but that"
|
||||
" name is an invalid alias name. Alias"
|
||||
" names may only contain letters, numbers,"
|
||||
" and underscores and must start with a letter.").format(alias_name))
|
||||
" names may not contain spaces.").format(alias_name))
|
||||
return
|
||||
# endregion
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user