feat: add get_clientkey

This commit is contained in:
JerryZRF
2024-12-21 20:43:15 +08:00
parent fb1f122ef7
commit 2954776539
3 changed files with 131 additions and 111 deletions

View File

@@ -0,0 +1,14 @@
import { ActionName } from '@/onebot/action/router';
import { OneBotAction } from '../OneBotAction';
interface GetClientkeyResponse {
clientkey?: string;
}
export class GetClientkey extends OneBotAction<void, GetClientkeyResponse> {
actionName = ActionName.GetClientkey;
async _handle() {
return { clientkey: (await this.core.apis.UserApi.forceFetchClientKey()).clientKey };
}
}

View File

@@ -102,6 +102,7 @@ import { SendGroupAiRecord } from "@/onebot/action/group/SendGroupAiRecord";
import { GetAiCharacters } from "@/onebot/action/extends/GetAiCharacters"; import { GetAiCharacters } from "@/onebot/action/extends/GetAiCharacters";
import { GetGuildList } from './guild/GetGuildList'; import { GetGuildList } from './guild/GetGuildList';
import { GetGuildProfile } from './guild/GetGuildProfile'; import { GetGuildProfile } from './guild/GetGuildProfile';
import { GetClientkey } from './extends/GetClientKey';
export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore) { export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore) {
@@ -123,6 +124,7 @@ export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCo
new GetGroupRootFiles(obContext, core), new GetGroupRootFiles(obContext, core),
new SetGroupSign(obContext, core), new SetGroupSign(obContext, core),
new SendGroupSign(obContext, core), new SendGroupSign(obContext, core),
new GetClientkey(obContext, core),
// onebot11 // onebot11
new SendLike(obContext, core), new SendLike(obContext, core),
new GetMsg(obContext, core), new GetMsg(obContext, core),

View File

@@ -1,3 +1,5 @@
import { GetClientkey } from "./extends/GetClientKey";
export type BaseCheckResult = ValidCheckResult | InvalidCheckResult; export type BaseCheckResult = ValidCheckResult | InvalidCheckResult;
export interface ValidCheckResult { export interface ValidCheckResult {
@@ -143,4 +145,6 @@ export const ActionName = {
GetAiRecord: "get_ai_record", GetAiRecord: "get_ai_record",
GetAiCharacters: "get_ai_characters", GetAiCharacters: "get_ai_characters",
SendGroupAiRecord: "send_group_ai_record", SendGroupAiRecord: "send_group_ai_record",
GetClientkey: "get_clientkey",
} as const; } as const;