mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-14 21:31:50 +00:00
fix: tweaks to config types
This commit is contained in:
parent
6110b8190c
commit
b0a9cf1bcd
5 changed files with 8 additions and 6 deletions
|
@ -27,7 +27,7 @@ import { automodAction } from "../helpers";
|
|||
|
||||
const configSchema = z.object({
|
||||
channel: zSnowflake,
|
||||
text: zBoundedCharacters(1, 4000),
|
||||
text: zBoundedCharacters(0, 4000),
|
||||
allowed_mentions: zNullishToUndefined(zAllowedMentions.nullable().default(null)),
|
||||
});
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import { PermissionsBitField, PermissionsString } from "discord.js";
|
|||
import { U } from "ts-toolbelt";
|
||||
import z from "zod";
|
||||
import { TemplateSafeValueContainer, renderTemplate } from "../../../templateFormatter";
|
||||
import { isValidSnowflake, keys, noop, zBoundedCharacters, zSnowflake } from "../../../utils";
|
||||
import { isValidSnowflake, keys, noop, zBoundedCharacters } from "../../../utils";
|
||||
import {
|
||||
guildToTemplateSafeGuild,
|
||||
savedMessageToTemplateSafeSavedMessage,
|
||||
|
@ -66,8 +66,8 @@ const allPermissionNames = [...permissionNames, ...legacyPermissionNames] as con
|
|||
|
||||
export const ChangePermsAction = automodAction({
|
||||
configSchema: z.strictObject({
|
||||
target: zBoundedCharacters(1, 255),
|
||||
channel: zBoundedCharacters(1, 255).nullable().default(null),
|
||||
target: zBoundedCharacters(1, 2000),
|
||||
channel: zBoundedCharacters(1, 2000).nullable().default(null),
|
||||
perms: z.record(
|
||||
z.enum(allPermissionNames),
|
||||
z.boolean().nullable(),
|
||||
|
|
|
@ -14,7 +14,7 @@ interface MatchResultType {
|
|||
const regexCache = new WeakMap<any, RegExp[]>();
|
||||
|
||||
const configSchema = z.strictObject({
|
||||
words: z.array(z.string().max(2000)).max(512),
|
||||
words: z.array(z.string().max(2000)).max(1024),
|
||||
case_sensitive: z.boolean().default(false),
|
||||
only_full_words: z.boolean().default(true),
|
||||
normalize: z.boolean().default(false),
|
||||
|
|
|
@ -69,7 +69,7 @@ export const zAutomodConfig = z.strictObject({
|
|||
rules: zBoundedRecord(
|
||||
z.record(z.string().max(100), zRule),
|
||||
0,
|
||||
100,
|
||||
255,
|
||||
),
|
||||
antiraid_levels: z.array(z.string().max(100)).max(10),
|
||||
can_set_antiraid: z.boolean(),
|
||||
|
|
|
@ -289,6 +289,8 @@ export type StrictMessageContent = {
|
|||
|
||||
export const zMessageContent = z.union([zBoundedCharacters(0, 4000), zStrictMessageContent]);
|
||||
|
||||
export type MessageContent = string | StrictMessageContent;
|
||||
|
||||
export function validateAndParseMessageContent(input: unknown): StrictMessageContent {
|
||||
if (input == null) {
|
||||
return {};
|
||||
|
|
Loading…
Add table
Reference in a new issue