From 7b5e70be3064ab0b8817f4706c06d44412bacb4b Mon Sep 17 00:00:00 2001 From: GRZ4NA Date: Sun, 5 Sep 2021 18:33:11 +0200 Subject: [PATCH] changed regexps to accept diacritics --- src/structures/BaseCommand.ts | 2 +- src/structures/Bot.ts | 1 - src/structures/MessageCommand.ts | 2 +- src/structures/Parameter.ts | 2 +- src/structures/TextCommand.ts | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/structures/BaseCommand.ts b/src/structures/BaseCommand.ts index 0495272..d6cf9ef 100644 --- a/src/structures/BaseCommand.ts +++ b/src/structures/BaseCommand.ts @@ -49,7 +49,7 @@ export class BaseCommand { */ private readonly function: CommandFunction; private readonly permissionChecker: (i: Message | CommandInteraction) => boolean; - public static nameRegExp: RegExp = /^[a-zA-Z0-9_ ]{1,32}$/; + public static nameRegExp: RegExp = /^.{1,32}$/; /** * @constructor diff --git a/src/structures/Bot.ts b/src/structures/Bot.ts index baec30c..9269de0 100644 --- a/src/structures/Bot.ts +++ b/src/structures/Bot.ts @@ -1,4 +1,3 @@ -import axios from "axios"; import { Client, CommandInteraction, GuildMember, Intents, Message } from "discord.js"; import { EventEmitter } from "events"; import * as http from "http"; diff --git a/src/structures/MessageCommand.ts b/src/structures/MessageCommand.ts index 7531d40..c13ff74 100644 --- a/src/structures/MessageCommand.ts +++ b/src/structures/MessageCommand.ts @@ -2,7 +2,7 @@ import { MessageCommandInit } from "../types/MessageCommand.js"; import { BaseCommand } from "./BaseCommand.js"; export class MessageCommand extends BaseCommand { - public static nameRegExp: RegExp = /^[a-zA-Z]{1,32}$/; + public static nameRegExp: RegExp = /^.{1,32}$/; constructor(o: MessageCommandInit) { if (!MessageCommand.nameRegExp.test(o.name)) { diff --git a/src/structures/Parameter.ts b/src/structures/Parameter.ts index 9665bd2..49de877 100644 --- a/src/structures/Parameter.ts +++ b/src/structures/Parameter.ts @@ -35,7 +35,7 @@ export class Parameter { public readonly choices?: string[]; public static nameRegExp: RegExp = /^[\w-]{1,32}$/; - public static descriptionRegExp: RegExp = /^[a-zA-Z0-9_ ]{1,100}$/; + public static descriptionRegExp: RegExp = /^.{1,100}$/; constructor(options: ParameterSchema) { this.name = options.name; diff --git a/src/structures/TextCommand.ts b/src/structures/TextCommand.ts index d7b7974..2d490b8 100644 --- a/src/structures/TextCommand.ts +++ b/src/structures/TextCommand.ts @@ -44,7 +44,7 @@ export class TextCommand extends BaseCommand { */ public readonly slash: boolean; public static nameRegExp: RegExp = /^[\w-]{1,32}$/; - public static descriptionRegExp: RegExp = /^[a-zA-Z0-9_ ]{1,100}$/; + public static descriptionRegExp: RegExp = /^.{1,100}$/; /** * Command constructor