mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
Merge pull request #443 from pk5ls20/feat/i18n-packet-server-error-msg
feat: More user-friendly packetServer error message
This commit is contained in:
commit
43f1d8c88c
@ -49,8 +49,8 @@ export class PacketHighwaySession {
|
|||||||
|
|
||||||
private async checkAvailable() {
|
private async checkAvailable() {
|
||||||
if (!this.packetClient.available) {
|
if (!this.packetClient.available) {
|
||||||
this.logger.logError('[Highway] packetClient not available!');
|
this.logger.logError('[Highway] packetServer not available!');
|
||||||
throw new Error('packetClient not available!');
|
throw new Error('packetServer不可用,请参照文档 https://napneko.github.io/config/advanced 检查packetServer状态或进行配置');
|
||||||
}
|
}
|
||||||
if (this.sig.sigSession === null || this.sig.sessionKey === null) {
|
if (this.sig.sigSession === null || this.sig.sessionKey === null) {
|
||||||
this.logger.logWarn('[Highway] sigSession or sessionKey not available!');
|
this.logger.logWarn('[Highway] sigSession or sessionKey not available!');
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import BaseAction from '../BaseAction';
|
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
|
import {GetPacketStatusDepends} from "@/onebot/action/packet/GetPacketStatus";
|
||||||
// no_cache get时传字符串
|
// no_cache get时传字符串
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
@ -12,14 +12,11 @@ const SchemaData = {
|
|||||||
|
|
||||||
type Payload = FromSchema<typeof SchemaData>;
|
type Payload = FromSchema<typeof SchemaData>;
|
||||||
|
|
||||||
export class GetUserStatus extends BaseAction<Payload, { status: number; ext_status: number; } | undefined> {
|
export class GetUserStatus extends GetPacketStatusDepends<Payload, { status: number; ext_status: number; } | undefined> {
|
||||||
actionName = ActionName.GetUserStatus;
|
actionName = ActionName.GetUserStatus;
|
||||||
payloadSchema = SchemaData;
|
payloadSchema = SchemaData;
|
||||||
|
|
||||||
async _handle(payload: Payload) {
|
async _handle(payload: Payload) {
|
||||||
if (!this.core.apis.PacketApi?.available) {
|
|
||||||
throw new Error('PacketClient is not init');
|
|
||||||
}
|
|
||||||
return await this.core.apis.PacketApi.sendStatusPacket(+payload.user_id);
|
return await this.core.apis.PacketApi.sendStatusPacket(+payload.user_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ export abstract class GetPacketStatusDepends<PT, RT> extends BaseAction<PT, RT>
|
|||||||
if (!this.core.apis.PacketApi.available) {
|
if (!this.core.apis.PacketApi.available) {
|
||||||
return {
|
return {
|
||||||
valid: false,
|
valid: false,
|
||||||
message: "PacketClient is not available!",
|
message: "packetServer不可用,请参照文档 https://napneko.github.io/config/advanced 检查packetServer状态或进行配置!",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user