mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix
This commit is contained in:
parent
3da49fbfba
commit
544682fe41
@ -32,7 +32,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cors": "^2.8.17",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/express": "^5.0.0",
|
||||
"@types/fluent-ffmpeg": "^2.1.26",
|
||||
"@types/node": "^20.14.15",
|
||||
"@types/ws": "^8.5.12",
|
||||
@ -40,7 +40,7 @@
|
||||
"electron-vite": "^2.3.0",
|
||||
"protobufjs-cli": "^1.1.3",
|
||||
"typescript": "^5.6.2",
|
||||
"vite": "^5.4.7",
|
||||
"vite": "^5.4.8",
|
||||
"vite-plugin-cp": "^4.0.8"
|
||||
},
|
||||
"packageManager": "yarn@4.5.0"
|
||||
|
@ -4,7 +4,7 @@ import { ActionName } from '../types'
|
||||
interface Payload {
|
||||
group_id: number | string
|
||||
user_id: number | string
|
||||
duration: number
|
||||
duration: number | string
|
||||
}
|
||||
|
||||
export default class SetGroupBan extends BaseAction<Payload, null> {
|
||||
@ -12,7 +12,7 @@ export default class SetGroupBan extends BaseAction<Payload, null> {
|
||||
payloadSchema = Schema.object({
|
||||
group_id: Schema.union([Number, String]).required(),
|
||||
user_id: Schema.union([Number, String]).required(),
|
||||
duration: Schema.number().default(30 * 60)
|
||||
duration: Schema.union([Number, String]).default(30 * 60)
|
||||
})
|
||||
|
||||
protected async _handle(payload: Payload): Promise<null> {
|
||||
@ -21,7 +21,7 @@ export default class SetGroupBan extends BaseAction<Payload, null> {
|
||||
const uid = await this.ctx.ntUserApi.getUidByUin(uin, groupCode)
|
||||
if (!uid) throw new Error('无法获取用户信息')
|
||||
await this.ctx.ntGroupApi.banMember(groupCode, [
|
||||
{ uid, timeStamp: payload.duration },
|
||||
{ uid, timeStamp: +payload.duration },
|
||||
])
|
||||
return null
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import {
|
||||
GroupNotifyType,
|
||||
RawMessage,
|
||||
BuddyReqType,
|
||||
Peer,
|
||||
FriendRequest,
|
||||
GroupMember,
|
||||
GroupMemberRole,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import http from 'node:http'
|
||||
import cors from 'cors'
|
||||
import crypto from 'node:crypto'
|
||||
import express, { Express, Request, Response } from 'express'
|
||||
import express, { Express, Request, Response, NextFunction } from 'express'
|
||||
import { BaseAction } from '../action/BaseAction'
|
||||
import { Context } from 'cordis'
|
||||
import { llonebotError, selfInfo } from '@/common/globalVars'
|
||||
@ -76,7 +76,7 @@ class OB11Http {
|
||||
Object.assign(this.config, config)
|
||||
}
|
||||
|
||||
private authorize(req: Request, res: Response, next: () => void) {
|
||||
private authorize(req: Request, res: Response, next: NextFunction) {
|
||||
const serverToken = this.config.token
|
||||
if (!serverToken) return next()
|
||||
|
||||
@ -95,12 +95,13 @@ class OB11Http {
|
||||
}
|
||||
|
||||
if (clientToken !== serverToken) {
|
||||
return res.status(403).json({ message: 'token verify failed!' })
|
||||
res.status(403).json({ message: 'token verify failed!' })
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
next()
|
||||
}
|
||||
|
||||
private async handleRequest(req: Request, res: Response, next: () => void) {
|
||||
private async handleRequest(req: Request, res: Response, next: NextFunction) {
|
||||
if (req.path === '/') return next()
|
||||
let payload = req.body
|
||||
if (req.method === 'GET') {
|
||||
|
@ -4,7 +4,6 @@
|
||||
"module": "CommonJS",
|
||||
"outDir": "./dist",
|
||||
"strict": true,
|
||||
"isolatedModules": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"experimentalDecorators": true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user