

























@@ -43,6 +43,7 @@ import { listAllChannelSupportedActions, listChannelSupportedActions } from "../
4343import {
4444channelTargetSchema,
4545channelTargetsSchema,
46+optionalNonNegativeIntegerSchema,
4647optionalPositiveIntegerSchema,
4748stringEnum,
4849} from "../schema/typebox.js";
@@ -306,8 +307,8 @@ function buildReactionSchema() {
306307307308function buildFetchSchema() {
308309return {
309-limit: Type.Optional(Type.Number()),
310-pageSize: Type.Optional(Type.Number()),
310+limit: optionalPositiveIntegerSchema(),
311+pageSize: optionalPositiveIntegerSchema(),
311312pageToken: Type.Optional(Type.String()),
312313before: Type.Optional(Type.String()),
313314after: Type.Optional(Type.String()),
@@ -333,13 +334,15 @@ function buildPollSchema() {
333334),
334335),
335336pollOptionIndex: Type.Optional(
336-Type.Number({
337+Type.Integer({
338+minimum: 1,
337339description: "1-based poll option number.",
338340}),
339341),
340342pollOptionIndexes: Type.Optional(
341343Type.Array(
342-Type.Number({
344+Type.Integer({
345+minimum: 1,
343346description: "1-based poll option numbers for multiselect.",
344347}),
345348),
@@ -402,7 +405,7 @@ function buildStickerSchema() {
402405function buildThreadSchema() {
403406return {
404407threadName: Type.Optional(Type.String()),
405-autoArchiveMin: Type.Optional(Type.Number()),
408+autoArchiveMin: optionalPositiveIntegerSchema(),
406409appliedTags: Type.Optional(Type.Array(Type.String())),
407410};
408411}
@@ -417,15 +420,15 @@ function buildEventSchema() {
417420desc: Type.Optional(Type.String()),
418421location: Type.Optional(Type.String()),
419422image: Type.Optional(Type.String({ description: "Event cover image URL/path." })),
420-durationMin: Type.Optional(Type.Number()),
423+durationMin: optionalNonNegativeIntegerSchema(),
421424until: Type.Optional(Type.String()),
422425};
423426}
424427425428function buildModerationSchema() {
426429return {
427430reason: Type.Optional(Type.String()),
428-deleteDays: Type.Optional(Type.Number()),
431+deleteDays: optionalNonNegativeIntegerSchema({ maximum: 7 }),
429432};
430433}
431434@@ -465,15 +468,16 @@ function buildChannelManagementSchema() {
465468return {
466469name: Type.Optional(Type.String()),
467470channelType: Type.Optional(
468-Type.Number({
471+Type.Integer({
472+minimum: 0,
469473description: "Numeric channel type, e.g. Discord. Avoids JSON Schema `type` collision.",
470474}),
471475),
472476parentId: Type.Optional(Type.String()),
473477topic: Type.Optional(Type.String()),
474-position: Type.Optional(Type.Number()),
478+position: optionalNonNegativeIntegerSchema(),
475479nsfw: Type.Optional(Type.Boolean()),
476-rateLimitPerUser: Type.Optional(Type.Number()),
480+rateLimitPerUser: optionalNonNegativeIntegerSchema(),
477481categoryId: Type.Optional(Type.String()),
478482clearParent: Type.Optional(
479483Type.Boolean({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。