refactor(builder): remove unsafe*Builders (#8074)

This commit is contained in:
Parbez
2022-07-07 00:12:51 +05:30
committed by GitHub
parent 34531c45e3
commit a4d1862982
24 changed files with 705 additions and 843 deletions

View File

@@ -1,14 +1,16 @@
import { s } from '@sapphire/shapeshift';
import { ApplicationCommandType } from 'discord-api-types/v10';
import type { ContextMenuCommandType } from './ContextMenuCommandBuilder';
import { isValidationEnabled } from '../../util/validation';
const namePredicate = s.string
.lengthGreaterThanOrEqual(1)
.lengthLessThanOrEqual(32)
.regex(/^( *[\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+ *)+$/u);
const typePredicate = s.union(s.literal(ApplicationCommandType.User), s.literal(ApplicationCommandType.Message));
.regex(/^( *[\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+ *)+$/u)
.setValidationEnabled(isValidationEnabled);
const typePredicate = s
.union(s.literal(ApplicationCommandType.User), s.literal(ApplicationCommandType.Message))
.setValidationEnabled(isValidationEnabled);
const booleanPredicate = s.boolean;
export function validateDefaultPermission(value: unknown): asserts value is boolean {