koishi-plugin-noah 2.3.6 → 2.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/api/auth.d.ts +18 -0
- package/lib/core/api/index.d.ts +3 -0
- package/lib/core/command.d.ts +4 -1
- package/lib/core/commands/settings.d.ts +3 -0
- package/lib/core/utils/selector.d.ts +13 -0
- package/lib/games/sdvx/utils/param-parser.d.ts +5 -3
- package/lib/index.cjs +883 -173
- package/lib/types/config.d.ts +6 -0
- package/package.json +5 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface TokenPayload {
|
|
2
|
+
uid: number;
|
|
3
|
+
iat: number;
|
|
4
|
+
exp: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ApiContext {
|
|
7
|
+
secret: string;
|
|
8
|
+
tokenTtl: number;
|
|
9
|
+
frontendUrl: string;
|
|
10
|
+
corsOrigin: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function resolveApiContext(config: {
|
|
13
|
+
tokenTtl?: number;
|
|
14
|
+
frontendUrl?: string;
|
|
15
|
+
corsOrigin?: string;
|
|
16
|
+
}): ApiContext;
|
|
17
|
+
export declare function createToken(uid: number, secret: string, ttlSeconds?: number): string;
|
|
18
|
+
export declare function verifyToken(token: string, secret: string): TokenPayload | null;
|
package/lib/core/command.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Context } from 'koishi';
|
|
2
2
|
import { CoreConfig } from '../types/config';
|
|
3
|
+
import { ApiContext } from './api/auth';
|
|
3
4
|
export declare const name = "command";
|
|
4
|
-
export declare function apply(ctx: Context, config: CoreConfig
|
|
5
|
+
export declare function apply(ctx: Context, config: CoreConfig & {
|
|
6
|
+
_apiCtx?: ApiContext;
|
|
7
|
+
}): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Session } from 'koishi';
|
|
2
|
+
import { CardService } from '../services/card-service';
|
|
3
|
+
import { ServerService } from '../services/server-service';
|
|
4
|
+
import { Card, Server } from '../types';
|
|
5
|
+
export type SelectResult<T> = {
|
|
6
|
+
ok: true;
|
|
7
|
+
value: T;
|
|
8
|
+
} | {
|
|
9
|
+
ok: false;
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function selectCard(session: Session, cardService: CardService, uid: number): Promise<SelectResult<Card>>;
|
|
13
|
+
export declare function selectServer(session: Session, serverService: ServerService, uid: number, channelId: string | null): Promise<SelectResult<Server>>;
|
|
@@ -8,6 +8,11 @@ export interface QueryParams {
|
|
|
8
8
|
grade?: SDVXGrade | SDVXGrade[];
|
|
9
9
|
clearType?: SDVXClearType | SDVXClearType[];
|
|
10
10
|
vf?: number | number[];
|
|
11
|
+
excludeLevel?: number[];
|
|
12
|
+
excludeScore?: number[];
|
|
13
|
+
excludeGrade?: SDVXGrade[];
|
|
14
|
+
excludeClearType?: SDVXClearType[];
|
|
15
|
+
excludeVf?: number[];
|
|
11
16
|
}
|
|
12
17
|
/**
|
|
13
18
|
* 解析带后缀的数字
|
|
@@ -49,7 +54,4 @@ export declare function parseSingleGrade(item: string): SDVXGrade[] | null;
|
|
|
49
54
|
* 解析雷达特征
|
|
50
55
|
*/
|
|
51
56
|
export declare function parseRadarFeature(item: string): string | null;
|
|
52
|
-
/**
|
|
53
|
-
* 解析用户输入参数
|
|
54
|
-
*/
|
|
55
57
|
export declare function parseQueryInput(input: string): QueryParams;
|