mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
feat: 支持set_diy_online_status
This commit is contained in:
@@ -46,6 +46,15 @@ export class NTQQUserApi {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async setDiySelfOnlineStatus(faceId: string, wording: string, faceType: string) {
|
||||||
|
return this.context.session.getMsgService().setStatus({
|
||||||
|
status: 10,
|
||||||
|
extStatus: 2000,
|
||||||
|
customStatus: { faceId: faceId, wording: wording, faceType: faceType },
|
||||||
|
batteryStatus: 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async getBuddyRecommendContactArkJson(uin: string, sencenID = '') {
|
async getBuddyRecommendContactArkJson(uin: string, sencenID = '') {
|
||||||
return this.context.session.getBuddyService().getBuddyRecommendContactArkJson(uin, sencenID);
|
return this.context.session.getBuddyService().getBuddyRecommendContactArkJson(uin, sencenID);
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ export interface NodeIKernelMsgService {
|
|||||||
|
|
||||||
kickOffLine(DevInfo: unknown): unknown;
|
kickOffLine(DevInfo: unknown): unknown;
|
||||||
|
|
||||||
setStatus(args: { status: number, extStatus: number, batteryStatus: number }): Promise<GeneralCallResult>;
|
setStatus(args: { status: number, extStatus: number, batteryStatus: number, customStatus?: { faceId: string, wording: string, faceType: string } }): Promise<GeneralCallResult>;
|
||||||
|
|
||||||
fetchStatusMgrInfo(): unknown;
|
fetchStatusMgrInfo(): unknown;
|
||||||
|
|
||||||
|
28
src/onebot/action/extends/SetDiyOnlineStatus.ts
Normal file
28
src/onebot/action/extends/SetDiyOnlineStatus.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { OneBotAction } from '@/onebot/action/OneBotAction';
|
||||||
|
import { ActionName } from '@/onebot/action/router';
|
||||||
|
import { Static, Type } from '@sinclair/typebox';
|
||||||
|
|
||||||
|
const SchemaData = Type.Object({
|
||||||
|
face_id: Type.Union([Type.Number(), Type.String()]),// 参考 face_config.json 的 QSid
|
||||||
|
face_type: Type.Union([Type.Number(), Type.String()], { default: '1' }),
|
||||||
|
wording: Type.String({ default: ' ' }),
|
||||||
|
});
|
||||||
|
|
||||||
|
type Payload = Static<typeof SchemaData>;
|
||||||
|
|
||||||
|
export class SeDiyOnlineStatus extends OneBotAction<Payload, string> {
|
||||||
|
override actionName = ActionName.SeDiyOnlineStatus;
|
||||||
|
override payloadSchema = SchemaData;
|
||||||
|
|
||||||
|
async _handle(payload: Payload) {
|
||||||
|
const ret = await this.core.apis.UserApi.setDiySelfOnlineStatus(
|
||||||
|
payload.face_id.toString(),
|
||||||
|
payload.face_type.toString(),
|
||||||
|
payload.wording,
|
||||||
|
);
|
||||||
|
if (ret.result !== 0) {
|
||||||
|
throw new Error('设置在线状态失败');
|
||||||
|
}
|
||||||
|
return ret.errMsg;
|
||||||
|
}
|
||||||
|
}
|
@@ -103,6 +103,7 @@ import { GetGuildProfile } from './guild/GetGuildProfile';
|
|||||||
import { GetClientkey } from './extends/GetClientkey';
|
import { GetClientkey } from './extends/GetClientkey';
|
||||||
import { SendPacket } from './extends/SendPacket';
|
import { SendPacket } from './extends/SendPacket';
|
||||||
import { SendPoke } from '@/onebot/action/packet/SendPoke';
|
import { SendPoke } from '@/onebot/action/packet/SendPoke';
|
||||||
|
import { SeDiyOnlineStatus } from './extends/SetDiyOnlineStatus';
|
||||||
|
|
||||||
export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore) {
|
export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore) {
|
||||||
|
|
||||||
@@ -209,6 +210,7 @@ export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCo
|
|||||||
new GetUserStatus(obContext, core),
|
new GetUserStatus(obContext, core),
|
||||||
new GetRkey(obContext, core),
|
new GetRkey(obContext, core),
|
||||||
new SetSpecialTittle(obContext, core),
|
new SetSpecialTittle(obContext, core),
|
||||||
|
new SeDiyOnlineStatus(obContext, core),
|
||||||
// new UploadForwardMsg(obContext, core),
|
// new UploadForwardMsg(obContext, core),
|
||||||
new GetGroupShutList(obContext, core),
|
new GetGroupShutList(obContext, core),
|
||||||
new GetGroupFileUrl(obContext, core),
|
new GetGroupFileUrl(obContext, core),
|
||||||
|
@@ -90,6 +90,7 @@ export const ActionName = {
|
|||||||
|
|
||||||
// 以下为扩展napcat扩展
|
// 以下为扩展napcat扩展
|
||||||
Unknown: 'unknown',
|
Unknown: 'unknown',
|
||||||
|
SeDiyOnlineStatus: 'set_diy_online_status',
|
||||||
SharePeer: 'ArkSharePeer',
|
SharePeer: 'ArkSharePeer',
|
||||||
ShareGroupEx: 'ArkShareGroup',
|
ShareGroupEx: 'ArkShareGroup',
|
||||||
// RebootNormal : 'reboot_normal', //无快速登录重新启动
|
// RebootNormal : 'reboot_normal', //无快速登录重新启动
|
||||||
|
Reference in New Issue
Block a user