diff --git a/packages/backend/src/server/api/endpoints/messaging/messages/create.ts b/packages/backend/src/server/api/endpoints/messaging/messages/create.ts index 87f262650c..f0916b7607 100644 --- a/packages/backend/src/server/api/endpoints/messaging/messages/create.ts +++ b/packages/backend/src/server/api/endpoints/messaging/messages/create.ts @@ -12,18 +12,19 @@ import type { MiUserGroup } from '@/models/entities/UserGroup.js'; import { GetterService } from '@/server/api/GetterService.js'; import { MessagingService } from '@/core/MessagingService.js'; import { DI } from '@/di-symbols.js'; +import { MAX_NOTE_TEXT_LENGTH } from '@/const.js'; import { ApiError } from '../../../error.js'; export const meta = { tags: ['messaging'], + requireCredential: true, + limit: { duration: ms('1hour'), max: 120, }, - requireCredential: true, - kind: 'write:messaging', res: { @@ -82,7 +83,7 @@ export const paramDef = { properties: { userId: { type: 'string', format: 'misskey:id' }, groupId: { type: 'string', format: 'misskey:id' }, - text: { type: 'string', nullable: true, maxLength: 3000 }, + text: { type: 'string', maxLength: MAX_NOTE_TEXT_LENGTH, nullable: true }, fileId: { type: 'string', format: 'misskey:id' }, }, anyOf: [ @@ -110,8 +111,8 @@ export default class extends Endpoint { // eslint- private messagingService: MessagingService, ) { super(meta, paramDef, async (ps, me) => { - let recipientUser: MiUser | null; - let recipientGroup: MiUserGroup | null; + let recipientUser: MiUser | undefined = undefined; + let recipientGroup: MiUserGroup | undefined = undefined; if (ps.userId != null) { // Myself