mirror of
https://github.com/chrononeko/chronocat.git
synced 2024-11-22 07:07:53 +00:00
feat(shell): add chronocat.putongdejiekou1
api def
This commit is contained in:
parent
890ea371ab
commit
72a9ac8fe8
@ -20,6 +20,7 @@ import { messageDelete } from './message/delete'
|
|||||||
import { messageGet } from './message/get'
|
import { messageGet } from './message/get'
|
||||||
import { messageList } from './message/list'
|
import { messageList } from './message/list'
|
||||||
import { notImplemented } from './notimpl'
|
import { notImplemented } from './notimpl'
|
||||||
|
import { puTongDeJieKou1 } from './putongdejiekou/1'
|
||||||
import type { Route } from './types'
|
import type { Route } from './types'
|
||||||
import { userChannelCreate } from './user/channel/create'
|
import { userChannelCreate } from './user/channel/create'
|
||||||
import { userGet } from './user/get'
|
import { userGet } from './user/get'
|
||||||
@ -63,6 +64,7 @@ const routesIntl = {
|
|||||||
'friend.list': friendList,
|
'friend.list': friendList,
|
||||||
'friend.approve': friendApprove,
|
'friend.approve': friendApprove,
|
||||||
'unsafe.friend.remove': friendRemove,
|
'unsafe.friend.remove': friendRemove,
|
||||||
|
'chronocat.putongdejiekou1': puTongDeJieKou1,
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
export type Routes = keyof typeof routesIntl
|
export type Routes = keyof typeof routesIntl
|
||||||
|
30
packages/shell/src/satori/routes/putongdejiekou/1.ts
Normal file
30
packages/shell/src/satori/routes/putongdejiekou/1.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import type { PuTongDeJieKou1Payload } from '../../types'
|
||||||
|
import type { RouteContext } from '../types'
|
||||||
|
|
||||||
|
export const puTongDeJieKou1 = async ({
|
||||||
|
cctx,
|
||||||
|
path,
|
||||||
|
req,
|
||||||
|
res,
|
||||||
|
json,
|
||||||
|
}: RouteContext) => {
|
||||||
|
const payload = (await json()) as PuTongDeJieKou1Payload
|
||||||
|
|
||||||
|
const validateResult = await cctx.chronocat.validate(
|
||||||
|
'PuTongDeJieKou1Payload',
|
||||||
|
)(payload)
|
||||||
|
|
||||||
|
if (validateResult) {
|
||||||
|
const err = `解析 ${path} 请求时出现问题,来自 ${req.socket.remoteAddress}。${validateResult}`
|
||||||
|
|
||||||
|
cctx.chronocat.l.error(err, {
|
||||||
|
code: 400,
|
||||||
|
})
|
||||||
|
|
||||||
|
res.writeHead(400)
|
||||||
|
res.end(`400 bad request\n${err}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return await cctx.chronocat.api['chronocat.putongdejiekou1'](payload)
|
||||||
|
}
|
@ -165,3 +165,10 @@ export interface GuildMemberTitleSetPayload {
|
|||||||
*/
|
*/
|
||||||
title?: string
|
title?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface PuTongDeJieKou1Payload {
|
||||||
|
g: string
|
||||||
|
a: string
|
||||||
|
b: string
|
||||||
|
d: string
|
||||||
|
}
|
||||||
|
@ -23,6 +23,7 @@ export type {
|
|||||||
MessageListPayload,
|
MessageListPayload,
|
||||||
MessageListResponse,
|
MessageListResponse,
|
||||||
Next,
|
Next,
|
||||||
|
PuTongDeJieKou1Payload,
|
||||||
UserGetPayload,
|
UserGetPayload,
|
||||||
UserPayload,
|
UserPayload,
|
||||||
} from './satoriPayloadEntity'
|
} from './satoriPayloadEntity'
|
||||||
|
@ -32,6 +32,7 @@ import type {
|
|||||||
MessageListPayload,
|
MessageListPayload,
|
||||||
MessageListResponse,
|
MessageListResponse,
|
||||||
Next,
|
Next,
|
||||||
|
PuTongDeJieKou1Payload,
|
||||||
User,
|
User,
|
||||||
UserGetPayload,
|
UserGetPayload,
|
||||||
UserPayload,
|
UserPayload,
|
||||||
@ -137,6 +138,8 @@ export interface SatoriMethods {
|
|||||||
'friend.list': [[Next], FriendListResponse]
|
'friend.list': [[Next], FriendListResponse]
|
||||||
'friend.approve': [[ApprovePayload], Record<string, never>]
|
'friend.approve': [[ApprovePayload], Record<string, never>]
|
||||||
'unsafe.friend.remove': [[UserPayload], Record<string, never>]
|
'unsafe.friend.remove': [[UserPayload], Record<string, never>]
|
||||||
|
|
||||||
|
'chronocat.putongdejiekou1': [[PuTongDeJieKou1Payload], Record<string, never>]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CCInternalMethods {
|
export interface CCInternalMethods {
|
||||||
|
Loading…
Reference in New Issue
Block a user