changed regexps to accept diacritics

This commit is contained in:
mmacierzanka committed 2021-09-05 18:33:11 +02:00
1 parent 05df486add
commit 7b5e70be30
5 files changed
+4 -5

No files matched your search

+1 -1
View File
@@ -49,7 +49,7 @@ export class BaseCommand {
*/ */
private readonly function: CommandFunction; private readonly function: CommandFunction;
private readonly permissionChecker: (i: Message | CommandInteraction) => boolean; private readonly permissionChecker: (i: Message | CommandInteraction) => boolean;
public static nameRegExp: RegExp = /^[a-zA-Z0-9_ ]{1,32}$/; public static nameRegExp: RegExp = /^.{1,32}$/;
/** /**
* @constructor * @constructor
-1
View File
@@ -1,4 +1,3 @@
import axios from "axios";
import { Client, CommandInteraction, GuildMember, Intents, Message } from "discord.js"; import { Client, CommandInteraction, GuildMember, Intents, Message } from "discord.js";
import { EventEmitter } from "events"; import { EventEmitter } from "events";
import * as http from "http"; import * as http from "http";
+1 -1
View File
@@ -2,7 +2,7 @@ import { MessageCommandInit } from "../types/MessageCommand.js";
import { BaseCommand } from "./BaseCommand.js"; import { BaseCommand } from "./BaseCommand.js";
export class MessageCommand extends BaseCommand { export class MessageCommand extends BaseCommand {
public static nameRegExp: RegExp = /^[a-zA-Z]{1,32}$/; public static nameRegExp: RegExp = /^.{1,32}$/;
constructor(o: MessageCommandInit) { constructor(o: MessageCommandInit) {
if (!MessageCommand.nameRegExp.test(o.name)) { if (!MessageCommand.nameRegExp.test(o.name)) {
+1 -1
View File
@@ -35,7 +35,7 @@ export class Parameter {
public readonly choices?: string[]; public readonly choices?: string[];
public static nameRegExp: RegExp = /^[\w-]{1,32}$/; 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) { constructor(options: ParameterSchema) {
this.name = options.name; this.name = options.name;
+1 -1
View File
@@ -44,7 +44,7 @@ export class TextCommand extends BaseCommand {
*/ */
public readonly slash: boolean; public readonly slash: boolean;
public static nameRegExp: RegExp = /^[\w-]{1,32}$/; 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 * Command constructor