Fixed config checker bugs & added new flags
This commit is contained in:
@@ -345,6 +345,7 @@ export class ODCheckerTranslationRegister_Default extends ODCheckerTranslationRe
|
||||
*/
|
||||
export interface ODCheckerFunctionManagerIds_Default {
|
||||
"openticket:unused-options":ODCheckerFunction,
|
||||
"openticket:unused-questions":ODCheckerFunction,
|
||||
"openticket:dropdown-options":ODCheckerFunction
|
||||
}
|
||||
|
||||
@@ -355,14 +356,14 @@ export interface ODCheckerFunctionManagerIds_Default {
|
||||
* This default class is made for the global variable `openticket.checkers.functions`!
|
||||
*/
|
||||
export class ODCheckerFunctionManager_Default extends ODCheckerFunctionManager {
|
||||
get<CheckerFunctionId extends keyof ODCheckerManagerIds_Default>(id:CheckerFunctionId): ODCheckerManagerIds_Default[CheckerFunctionId]
|
||||
get<CheckerFunctionId extends keyof ODCheckerFunctionManagerIds_Default>(id:CheckerFunctionId): ODCheckerFunctionManagerIds_Default[CheckerFunctionId]
|
||||
get(id:ODValidId): ODCheckerFunction|null
|
||||
|
||||
get(id:ODValidId): ODCheckerFunction|null {
|
||||
return super.get(id)
|
||||
}
|
||||
|
||||
remove<CheckerFunctionId extends keyof ODCheckerManagerIds_Default>(id:CheckerFunctionId): ODCheckerManagerIds_Default[CheckerFunctionId]
|
||||
remove<CheckerFunctionId extends keyof ODCheckerFunctionManagerIds_Default>(id:CheckerFunctionId): ODCheckerFunctionManagerIds_Default[CheckerFunctionId]
|
||||
remove(id:ODValidId): ODCheckerFunction|null
|
||||
|
||||
remove(id:ODValidId): ODCheckerFunction|null {
|
||||
|
||||
@@ -21,6 +21,8 @@ export interface ODFlagManagerIds_Default {
|
||||
"openticket:no-plugins":ODFlag,
|
||||
"openticket:soft-plugins":ODFlag,
|
||||
"openticket:force-slash-update":ODFlag,
|
||||
"openticket:no-compile":ODFlag,
|
||||
"openticket:compile-only":ODFlag,
|
||||
}
|
||||
|
||||
/**## ODFlagManager_Default `default_class`
|
||||
|
||||
@@ -1192,12 +1192,20 @@ export class ODCheckerCustomStructure_EmojiString extends ODCheckerStringStructu
|
||||
const newOptions = options ?? {}
|
||||
newOptions.custom = (checker,value,locationTrace,locationId,locationDocs) => {
|
||||
const lt = checker.locationTraceDeref(locationTrace)
|
||||
|
||||
if (typeof value != "string") return false
|
||||
else if ([...value].length < minLength){
|
||||
|
||||
const emojis: string[] = []
|
||||
const emojiSplitRegex = /(?:(?:\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])|(?:<a?:[^:]*:[0-9]+>))/g
|
||||
let emoji = emojiSplitRegex.exec(value)
|
||||
while (emoji != null){
|
||||
emojis.push(emoji[0])
|
||||
emoji = emojiSplitRegex.exec(value)
|
||||
}
|
||||
|
||||
if (emojis.length < minLength){
|
||||
checker.createMessage("openticket:emoji-too-short","error",`This string needs to have at least ${minLength} emoji's!`,lt,null,[maxLength.toString()],this.id,(this.options.docs ?? null))
|
||||
return false
|
||||
}else if ([...value].length > maxLength){
|
||||
}else if (emojis.length > maxLength){
|
||||
checker.createMessage("openticket:emoji-too-long","error",`This string needs to have at most ${maxLength} emoji's!`,lt,null,[maxLength.toString()],this.id,(this.options.docs ?? null))
|
||||
return false
|
||||
}else if (!allowCustomDiscordEmoji && /<a?:[^:]*:[0-9]+>/.test(value)){
|
||||
|
||||
@@ -12,6 +12,7 @@ export const loadAllConfigCheckers = async () => {
|
||||
|
||||
export const loadAllConfigCheckerFunctions = async () => {
|
||||
openticket.checkers.functions.add(new api.ODCheckerFunction("openticket:unused-options",defaultUnusedOptionsFunction))
|
||||
openticket.checkers.functions.add(new api.ODCheckerFunction("openticket:unused-questions",defaultUnusedQuestionsFunction))
|
||||
openticket.checkers.functions.add(new api.ODCheckerFunction("openticket:dropdown-options",defaultDropdownOptionsFunction))
|
||||
}
|
||||
|
||||
|
||||
@@ -13,4 +13,6 @@ export const loadAllFlags = async () => {
|
||||
openticket.flags.add(new api.ODFlag("openticket:no-plugins","No Plugins","Disable all Open Ticket plugins!","--no-plugins",["-np"]))
|
||||
openticket.flags.add(new api.ODFlag("openticket:soft-plugins","Soft Plugins","Don't crash the bot when a plugin crashes!","--soft-plugins",["-sp"]))
|
||||
openticket.flags.add(new api.ODFlag("openticket:force-slash-update","Force Slash Update","Force update all slash commands.","--force-slash",["-fs"]))
|
||||
openticket.flags.add(new api.ODFlag("openticket:no-compile","No Compile","Disable compilation of plugins & bot before starting.","--no-compile",[]))
|
||||
openticket.flags.add(new api.ODFlag("openticket:compile-only","Compile Only","This description will never be shown because the bot wouldn't run when this flag is enabled :)","--compile-only",[]))
|
||||
}
|
||||
Reference in New Issue
Block a user