mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat:设置自身在线状态
This commit is contained in:
parent
cd6c32b21d
commit
f0a0c90304
@ -7,4 +7,5 @@
|
|||||||
7. 表情回应api和上报
|
7. 表情回应api和上报
|
||||||
8. 支持获取Cookies 实现更加稳定 API: /get_cookies
|
8. 支持获取Cookies 实现更加稳定 API: /get_cookies
|
||||||
9. 新增wsHost和httpHost配置
|
9. 新增wsHost和httpHost配置
|
||||||
10. 新增获取官方Bot账号范围 API: /get_robot_uin_range
|
10. 新增获取官方Bot账号范围 API: /get_robot_uin_range
|
||||||
|
11. 新增设置自身在线状态 API: /set_online_status
|
29
src/onebot11/action/extends/SetOnlineStatus.ts
Normal file
29
src/onebot11/action/extends/SetOnlineStatus.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import { OB11User } from '../../types';
|
||||||
|
import { OB11Constructor } from '../../constructor';
|
||||||
|
import { friends } from '../../../common/data';
|
||||||
|
import BaseAction from '../BaseAction';
|
||||||
|
import { ActionName } from '../types';
|
||||||
|
import { NTQQUserApi } from '@/core/apis';
|
||||||
|
// 设置在线状态
|
||||||
|
interface Payload {
|
||||||
|
status: number;
|
||||||
|
extStatus: number;
|
||||||
|
batteryStatus: number;
|
||||||
|
}
|
||||||
|
export class SetOnlineStatus extends BaseAction<Payload, null> {
|
||||||
|
actionName = ActionName.SetOnlineStatus;
|
||||||
|
|
||||||
|
protected async _handle(payload: Payload) {
|
||||||
|
// 可设置状态
|
||||||
|
// { status: 10, extStatus: 1027, batteryStatus: 0 }
|
||||||
|
// { status: 30, extStatus: 0, batteryStatus: 0 }
|
||||||
|
// { status: 50, extStatus: 0, batteryStatus: 0 }
|
||||||
|
// { status: 60, extStatus: 0, batteryStatus: 0 }
|
||||||
|
// { status: 70, extStatus: 0, batteryStatus: 0 }
|
||||||
|
let ret = await NTQQUserApi.setSelfOnlineStatus(payload.status, payload.extStatus, payload.batteryStatus);
|
||||||
|
if (ret.result !== 0) {
|
||||||
|
throw new Error("设置在线状态失败");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -48,6 +48,7 @@ import GetFriendMsgHistory from './go-cqhttp/GetFriendMsgHistory';
|
|||||||
import { GetCookies } from './user/GetCookies';
|
import { GetCookies } from './user/GetCookies';
|
||||||
import { SetMsgEmojiLike } from '@/onebot11/action/msg/SetMsgEmojiLike';
|
import { SetMsgEmojiLike } from '@/onebot11/action/msg/SetMsgEmojiLike';
|
||||||
import { GetRobotUinRange } from './extends/GetRobotUinRange';
|
import { GetRobotUinRange } from './extends/GetRobotUinRange';
|
||||||
|
import { SetOnlineStatus } from './extends/SetOnlineStatus';
|
||||||
|
|
||||||
export const actionHandlers = [
|
export const actionHandlers = [
|
||||||
new GetFile(),
|
new GetFile(),
|
||||||
@ -86,6 +87,7 @@ export const actionHandlers = [
|
|||||||
// new CleanCache(),
|
// new CleanCache(),
|
||||||
new GetCookies(),
|
new GetCookies(),
|
||||||
//
|
//
|
||||||
|
new SetOnlineStatus(),
|
||||||
new GetRobotUinRange(),
|
new GetRobotUinRange(),
|
||||||
//以下为go-cqhttp api
|
//以下为go-cqhttp api
|
||||||
new GoCQHTTPSendForwardMsg(),
|
new GoCQHTTPSendForwardMsg(),
|
||||||
|
@ -54,6 +54,7 @@ export enum ActionName {
|
|||||||
GetCookies = 'get_cookies',
|
GetCookies = 'get_cookies',
|
||||||
// 以下为扩展napcat扩展
|
// 以下为扩展napcat扩展
|
||||||
GetRobotUinRange = 'get_robot_uin_range',
|
GetRobotUinRange = 'get_robot_uin_range',
|
||||||
|
SetOnlineStatus = 'set_online_status',
|
||||||
// 以下为go-cqhttp api
|
// 以下为go-cqhttp api
|
||||||
GoCQHTTP_SendForwardMsg = 'send_forward_msg',
|
GoCQHTTP_SendForwardMsg = 'send_forward_msg',
|
||||||
GoCQHTTP_SendGroupForwardMsg = 'send_group_forward_msg',
|
GoCQHTTP_SendGroupForwardMsg = 'send_group_forward_msg',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user