mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-04 14:41:14 +00:00
Refactor action examples and enhance metadata
Replaced generic ActionExamples imports with more specific examples modules (FileActionsExamples, GroupActionsExamples, GoCQHTTPActionsExamples) across file, group, and go-cqhttp actions. Added or updated actionSummary, actionDescription, actionTags, payloadExample, and returnExample properties for improved API documentation and clarity.
This commit is contained in:
parent
1df3742748
commit
8623fb1df0
@ -5,6 +5,7 @@ import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { OB11MessageImage, OB11MessageVideo } from '@/napcat-onebot/types';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { FileActionsExamples } from './examples';
|
||||
|
||||
export const GetFilePayloadSchema = Type.Object({
|
||||
file: Type.Optional(Type.String({ description: '文件路径、URL或Base64' })),
|
||||
@ -121,4 +122,6 @@ export default class GetFile extends GetFileBase {
|
||||
override actionSummary = '获取文件';
|
||||
override actionDescription = '获取指定文件的详细信息及下载路径';
|
||||
override actionTags = ['文件接口'];
|
||||
override payloadExample = FileActionsExamples.GetFile.payload;
|
||||
override returnExample = FileActionsExamples.GetFile.response;
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ import { FileNapCatOneBotUUID } from 'napcat-common/src/file-uuid';
|
||||
import { GetPacketStatusDepends } from '@/napcat-onebot/action/packet/GetPacketStatus';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { FileActionsExamples } from './examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
@ -22,10 +22,11 @@ export class GetGroupFileUrl extends GetPacketStatusDepends<PayloadType, ReturnT
|
||||
override actionName = ActionName.GOCQHTTP_GetGroupFileUrl;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '获取群文件URL';
|
||||
override actionSummary = '获取群文件URL';
|
||||
override actionDescription = '获取指定群文件的下载链接';
|
||||
override actionTags = ['文件接口'];
|
||||
override payloadExample = ActionExamples.GetGroupFileUrl.payload;
|
||||
override returnExample = ActionExamples.GetGroupFileUrl.return;
|
||||
override payloadExample = FileActionsExamples.GetGroupFileUrl.payload;
|
||||
override returnExample = FileActionsExamples.GetGroupFileUrl.response;
|
||||
|
||||
async _handle (payload: PayloadType) {
|
||||
const contextMsgFile = FileNapCatOneBotUUID.decode(payload.file_id) || FileNapCatOneBotUUID.decodeModelId(payload.file_id);
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
import { GetFileBase } from './GetFile';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { FileActionsExamples } from './examples';
|
||||
|
||||
export default class GetImage extends GetFileBase {
|
||||
override actionName = ActionName.GetImage;
|
||||
override actionSummary = '获取图片';
|
||||
override actionDescription = '获取图片信息';
|
||||
override actionDescription = '获取指定图片的信息及路径';
|
||||
override actionTags = ['文件接口'];
|
||||
override payloadExample = ActionExamples.GetImage.payload;
|
||||
override returnExample = ActionExamples.GetImage.return;
|
||||
override payloadExample = FileActionsExamples.GetImage.payload;
|
||||
override returnExample = FileActionsExamples.GetImage.response;
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ import { FileNapCatOneBotUUID } from 'napcat-common/src/file-uuid';
|
||||
import { GetPacketStatusDepends } from '@/napcat-onebot/action/packet/GetPacketStatus';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { FileActionsExamples } from './examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
file_id: Type.String({ description: '文件ID' }),
|
||||
@ -21,10 +21,11 @@ export class GetPrivateFileUrl extends GetPacketStatusDepends<PayloadType, Retur
|
||||
override actionName = ActionName.NapCat_GetPrivateFileUrl;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '获取私聊文件URL';
|
||||
override actionSummary = '获取私聊文件URL';
|
||||
override actionDescription = '获取指定私聊文件的下载链接';
|
||||
override actionTags = ['文件接口'];
|
||||
override payloadExample = ActionExamples.GetPrivateFileUrl.payload;
|
||||
override returnExample = ActionExamples.GetPrivateFileUrl.return;
|
||||
override payloadExample = FileActionsExamples.GetPrivateFileUrl.payload;
|
||||
override returnExample = FileActionsExamples.GetPrivateFileUrl.response;
|
||||
|
||||
async _handle (payload: PayloadType) {
|
||||
const contextMsgFile = FileNapCatOneBotUUID.decode(payload.file_id);
|
||||
|
||||
@ -4,7 +4,7 @@ import { promises as fs } from 'fs';
|
||||
import { FFmpegService } from '@/napcat-core/helper/ffmpeg/ffmpeg';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { FileActionsExamples } from './examples';
|
||||
|
||||
const out_format_list = ['mp3', 'amr', 'wma', 'm4a', 'spx', 'ogg', 'wav', 'flac'];
|
||||
|
||||
@ -19,9 +19,11 @@ type PayloadType = Static<typeof PayloadSchema>;
|
||||
export default class GetRecord extends GetFileBase {
|
||||
override actionName = ActionName.GetRecord;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override actionDescription = '获取语音';
|
||||
override payloadExample = ActionExamples.GetRecord.payload;
|
||||
override returnExample = ActionExamples.GetRecord.return;
|
||||
override actionSummary = '获取语音';
|
||||
override actionDescription = '获取指定语音文件的信息,并支持格式转换';
|
||||
override actionTags = ['文件接口'];
|
||||
override payloadExample = FileActionsExamples.GetRecord.payload;
|
||||
override returnExample = FileActionsExamples.GetRecord.response;
|
||||
|
||||
override async _handle (payload: PayloadType): Promise<GetFileResponse> {
|
||||
const res = await super._handle(payload as GetFilePayload);
|
||||
|
||||
@ -19,9 +19,11 @@ export class DeleteGroupFile extends OneBotAction<PayloadType, ReturnType> {
|
||||
override actionName = ActionName.GOCQHTTP_DeleteGroupFile;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '删除群文件';
|
||||
override actionSummary = '删除群文件';
|
||||
override actionDescription = '在群文件系统中删除指定的文件';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.DeleteGroupFile.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.DeleteGroupFile.response;
|
||||
|
||||
async _handle (payload: PayloadType) {
|
||||
const data = FileNapCatOneBotUUID.decodeModelId(payload.file_id);
|
||||
|
||||
@ -19,9 +19,11 @@ export class DeleteGroupFileFolder extends OneBotAction<PayloadType, ReturnType>
|
||||
override actionName = ActionName.GoCQHTTP_DeleteGroupFileFolder;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '删除群文件目录';
|
||||
override actionSummary = '删除群文件目录';
|
||||
override actionDescription = '在群文件系统中删除指定的文件夹';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.DeleteGroupFileFolder.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.DeleteGroupFileFolder.response;
|
||||
|
||||
async _handle (payload: PayloadType) {
|
||||
return (await this.core.apis.GroupApi.delGroupFileFolder(
|
||||
|
||||
@ -26,9 +26,11 @@ export default class GoCQHTTPDownloadFile extends OneBotAction<PayloadType, Retu
|
||||
override actionName = ActionName.GoCQHTTP_DownloadFile;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '下载文件';
|
||||
override actionSummary = '下载文件';
|
||||
override actionDescription = '下载网络文件到本地临时目录';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.DownloadFile.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.DownloadFile.response;
|
||||
|
||||
async _handle (payload: PayloadType): Promise<ReturnType> {
|
||||
const isRandomName = !payload.name;
|
||||
|
||||
@ -28,9 +28,11 @@ export class GoCQHTTPGetForwardMsgAction extends OneBotAction<PayloadType, Retur
|
||||
override actionName = ActionName.GoCQHTTP_GetForwardMsg;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '获取合并转发消息';
|
||||
override actionSummary = '获取合并转发消息';
|
||||
override actionDescription = '获取合并转发消息的具体内容';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GetForwardMsg.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GetForwardMsg.response;
|
||||
|
||||
private createTemplateNode (message: OB11Message): OB11MessageNode {
|
||||
return {
|
||||
|
||||
@ -31,9 +31,11 @@ export default class GetFriendMsgHistory extends OneBotAction<PayloadType, Retur
|
||||
override actionName = ActionName.GetFriendMsgHistory;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '获取好友历史消息';
|
||||
override actionSummary = '获取好友历史消息';
|
||||
override actionDescription = '获取指定好友的历史聊天记录';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GetFriendMsgHistory.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GetFriendMsgHistory.response;
|
||||
|
||||
async _handle (payload: PayloadType, _adapter: string, config: NetworkAdapterConfig): Promise<ReturnType> {
|
||||
// 处理参数
|
||||
|
||||
@ -21,9 +21,11 @@ export class GoCQHTTPGetGroupAtAllRemain extends OneBotAction<PayloadType, Retur
|
||||
override actionName = ActionName.GoCQHTTP_GetGroupAtAllRemain;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '获取群艾特全体剩余次数';
|
||||
override actionSummary = '获取群艾特全体剩余次数';
|
||||
override actionDescription = '获取指定群聊中艾特全体成员的剩余次数';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GetGroupAtAllRemain.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GetGroupAtAllRemain.response;
|
||||
|
||||
async _handle (payload: PayloadType) {
|
||||
const ret = await this.core.apis.GroupApi.getGroupRemainAtTimes(payload.group_id.toString());
|
||||
|
||||
@ -26,6 +26,7 @@ export class GetGroupFileSystemInfo extends OneBotAction<PayloadType, ReturnType
|
||||
override actionDescription = '获取群聊文件系统的空间及状态信息';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GetGroupFileSystemInfo.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GetGroupFileSystemInfo.response;
|
||||
|
||||
async _handle (payload: PayloadType) {
|
||||
const groupFileCount = (await this.core.apis.GroupApi.getGroupFileCount([payload.group_id.toString()])).groupFileCounts[0];
|
||||
|
||||
@ -24,9 +24,11 @@ export class GetGroupFilesByFolder extends OneBotAction<PayloadType, ReturnType>
|
||||
override actionName = ActionName.GoCQHTTP_GetGroupFilesByFolder;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '获取群文件夹文件列表';
|
||||
override actionSummary = '获取群文件夹文件列表';
|
||||
override actionDescription = '获取指定群文件夹下的文件及子文件夹列表';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GetGroupFilesByFolder.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GetGroupFilesByFolder.response;
|
||||
|
||||
async _handle (payload: PayloadType): Promise<ReturnType> {
|
||||
const retRaw = await this.core.apis.MsgApi.getGroupFileList(payload.group_id.toString(), {
|
||||
|
||||
@ -27,9 +27,11 @@ export class GetGroupHonorInfo extends OneBotAction<PayloadType, ReturnType> {
|
||||
override actionName = ActionName.GetGroupHonorInfo;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '获取群荣誉信息';
|
||||
override actionSummary = '获取群荣誉信息';
|
||||
override actionDescription = '获取指定群聊的荣誉信息,如龙王等';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GetGroupHonorInfo.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GetGroupHonorInfo.response;
|
||||
|
||||
async _handle (payload: PayloadType): Promise<ReturnType> {
|
||||
if (!payload.type) {
|
||||
|
||||
@ -30,9 +30,11 @@ export default class GoCQHTTPGetGroupMsgHistory extends OneBotAction<PayloadType
|
||||
override actionName = ActionName.GoCQHTTP_GetGroupMsgHistory;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '获取群历史消息';
|
||||
override actionSummary = '获取群历史消息';
|
||||
override actionDescription = '获取指定群聊的历史聊天记录';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GetGroupMsgHistory.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GetGroupMsgHistory.response;
|
||||
|
||||
async _handle (payload: PayloadType, _adapter: string, config: NetworkAdapterConfig): Promise<ReturnType> {
|
||||
const peer: Peer = { chatType: ChatType.KCHATTYPEGROUP, peerUid: payload.group_id.toString() };
|
||||
|
||||
@ -26,6 +26,7 @@ export class GetGroupRootFiles extends OneBotAction<PayloadType, ReturnType> {
|
||||
override actionDescription = '获取群文件根目录下的所有文件和文件夹';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GetGroupRootFiles.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GetGroupRootFiles.response;
|
||||
|
||||
async _handle (payload: PayloadType) {
|
||||
const ret = await this.core.apis.MsgApi.getGroupFileList(payload.group_id.toString(), {
|
||||
|
||||
@ -16,9 +16,11 @@ export class GetOnlineClient extends OneBotAction<PayloadType, ReturnType> {
|
||||
override actionName = ActionName.GetOnlineClient;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '获取在线客户端';
|
||||
override actionSummary = '获取在线客户端';
|
||||
override actionDescription = '获取当前登录账号的在线客户端列表';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GetOnlineClient.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GetOnlineClient.response;
|
||||
|
||||
async _handle () {
|
||||
// 注册监听
|
||||
|
||||
@ -41,6 +41,7 @@ export default class GoCQHTTPGetStrangerInfo extends OneBotAction<PayloadType, R
|
||||
override actionDescription = '获取指定非好友用户的信息';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GetStrangerInfo.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GetStrangerInfo.response;
|
||||
|
||||
async _handle (payload: PayloadType): Promise<ReturnType> {
|
||||
const user_id = payload.user_id.toString();
|
||||
|
||||
@ -19,9 +19,11 @@ export class GoCQHTTPCheckUrlSafely extends OneBotAction<GoCQHTTPCheckUrlSafelyP
|
||||
override actionName = ActionName.GoCQHTTP_CheckUrlSafely;
|
||||
override payloadSchema = GoCQHTTPCheckUrlSafelyPayloadSchema;
|
||||
override returnSchema = GoCQHTTPCheckUrlSafelyReturnSchema;
|
||||
override actionDescription = '检查 URL 安全性';
|
||||
override actionSummary = '检查URL安全性';
|
||||
override actionDescription = '检查指定URL的安全等级';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GoCQHTTPCheckUrlSafely.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GoCQHTTPCheckUrlSafely.response;
|
||||
|
||||
async _handle () {
|
||||
return { level: 1 };
|
||||
|
||||
@ -16,9 +16,11 @@ export class GoCQHTTPDeleteFriend extends OneBotAction<GoCQHTTPDeleteFriendPaylo
|
||||
override actionName = ActionName.GoCQHTTP_DeleteFriend;
|
||||
override payloadSchema = GoCQHTTPDeleteFriendPayloadSchema;
|
||||
override returnSchema = Type.Any();
|
||||
override actionDescription = '删除好友';
|
||||
override actionSummary = '删除好友';
|
||||
override actionDescription = '从好友列表中删除指定用户';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GoCQHTTPDeleteFriend.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GoCQHTTPDeleteFriend.response;
|
||||
|
||||
async _handle (payload: GoCQHTTPDeleteFriendPayload) {
|
||||
const uin = payload.friend_id ?? payload.user_id ?? '';
|
||||
|
||||
@ -22,9 +22,11 @@ export class GoCQHTTPGetModelShow extends OneBotAction<GoCQHTTPGetModelShowPaylo
|
||||
override actionName = ActionName.GoCQHTTP_GetModelShow;
|
||||
override payloadSchema = GoCQHTTPGetModelShowPayloadSchema;
|
||||
override returnSchema = GoCQHTTPGetModelShowReturnSchema;
|
||||
override actionDescription = '获取模型显示';
|
||||
override actionSummary = '获取模型显示';
|
||||
override actionDescription = '获取当前账号可用的设备模型显示名称列表';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GoCQHTTPGetModelShow.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GoCQHTTPGetModelShow.response;
|
||||
|
||||
async _handle (payload: GoCQHTTPGetModelShowPayload) {
|
||||
if (!payload.model) {
|
||||
|
||||
@ -8,9 +8,11 @@ export class GoCQHTTPSetModelShow extends OneBotAction<void, void> {
|
||||
override actionName = ActionName.GoCQHTTP_SetModelShow;
|
||||
override payloadSchema = Type.Object({});
|
||||
override returnSchema = Type.Null();
|
||||
override actionDescription = '设置模型显示';
|
||||
override actionSummary = '设置模型显示';
|
||||
override actionDescription = '设置当前账号的设备模型显示名称';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.GoCQHTTPSetModelShow.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.GoCQHTTPSetModelShow.response;
|
||||
|
||||
async _handle () {
|
||||
|
||||
|
||||
@ -63,9 +63,11 @@ export class GoCQHTTPHandleQuickAction extends OneBotAction<GoCQHTTPHandleQuickA
|
||||
override actionName = ActionName.GoCQHTTP_HandleQuickAction;
|
||||
override payloadSchema = GoCQHTTPHandleQuickActionPayloadSchema;
|
||||
override returnSchema = Type.Null();
|
||||
override actionDescription = '处理快速操作';
|
||||
override actionSummary = '处理快速操作';
|
||||
override actionDescription = '处理来自事件上报的快速操作请求';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.QuickAction.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.QuickAction.response;
|
||||
|
||||
async _handle (payload: GoCQHTTPHandleQuickActionPayload): Promise<void> {
|
||||
this.obContext.apis.QuickActionApi
|
||||
|
||||
@ -2,6 +2,8 @@ import { OB11MessageMixType } from '@/napcat-onebot/types';
|
||||
import { ContextMode, normalize, ReturnDataType, SendMsgBase, SendMsgPayload } from '@/napcat-onebot/action/msg/SendMsg';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
|
||||
import { GoCQHTTPActionsExamples } from './examples';
|
||||
|
||||
// 未验证
|
||||
type GoCQHTTPSendForwardMsgPayload = SendMsgPayload & { messages?: OB11MessageMixType; };
|
||||
|
||||
@ -13,8 +15,11 @@ export class GoCQHTTPSendForwardMsgBase extends SendMsgBase {
|
||||
}
|
||||
export class GoCQHTTPSendForwardMsg extends GoCQHTTPSendForwardMsgBase {
|
||||
override actionName = ActionName.GoCQHTTP_SendForwardMsg;
|
||||
override actionSummary = '发送合并转发消息';
|
||||
override actionDescription = '发送合并转发消息';
|
||||
override actionTags = ['消息接口'];
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.SendForwardMsg.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.SendForwardMsg.response;
|
||||
|
||||
protected override async check (payload: GoCQHTTPSendForwardMsgPayload) {
|
||||
if (payload.messages) payload.message = normalize(payload.messages);
|
||||
|
||||
@ -22,9 +22,11 @@ export class SendGroupNotice extends OneBotAction<SendGroupNoticePayload, void>
|
||||
override actionName = ActionName.GoCQHTTP_SendGroupNotice;
|
||||
override payloadSchema = SendGroupNoticePayloadSchema;
|
||||
override returnSchema = Type.Null();
|
||||
override actionDescription = '发送群公告';
|
||||
override actionSummary = '发送群公告';
|
||||
override actionDescription = '在指定群聊中发布新的公告';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.SendGroupNotice.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.SendGroupNotice.response;
|
||||
|
||||
async _handle (payload: SendGroupNoticePayload) {
|
||||
let UploadImage: { id: string, width: number, height: number; } | undefined;
|
||||
|
||||
@ -23,9 +23,11 @@ export default class SetGroupPortrait extends OneBotAction<SetGroupPortraitPaylo
|
||||
override actionName = ActionName.SetGroupPortrait;
|
||||
override payloadSchema = SetGroupPortraitPayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '设置群头像';
|
||||
override actionSummary = '设置群头像';
|
||||
override actionDescription = '修改指定群聊的头像';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.SetGroupPortrait.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.SetGroupPortrait.response;
|
||||
|
||||
async _handle (payload: SetGroupPortraitPayload): Promise<ReturnType> {
|
||||
const { path, success } = (await uriToLocalFile(this.core.NapCatTempPath, payload.file));
|
||||
|
||||
@ -14,9 +14,11 @@ export class SetQQProfile extends OneBotAction<SetQQProfilePayload, any> {
|
||||
override actionName = ActionName.SetQQProfile;
|
||||
override payloadSchema = SetQQProfilePayloadSchema;
|
||||
override returnSchema = Type.Any({ description: '设置结果' });
|
||||
override actionDescription = '设置 QQ 资料';
|
||||
override actionSummary = '设置QQ资料';
|
||||
override actionDescription = '修改当前账号的昵称、个性签名等资料';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.SetQQProfile.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.SetQQProfile.response;
|
||||
|
||||
async _handle (payload: SetQQProfilePayload) {
|
||||
const self = this.core.selfInfo;
|
||||
|
||||
@ -28,9 +28,11 @@ export default class GoCQHTTPUploadGroupFile extends OneBotAction<GoCQHTTPUpload
|
||||
override actionName = ActionName.GoCQHTTP_UploadGroupFile;
|
||||
override payloadSchema = GoCQHTTPUploadGroupFilePayloadSchema;
|
||||
override returnSchema = GoCQHTTPUploadGroupFileReturnSchema;
|
||||
override actionDescription = '上传群文件';
|
||||
override actionSummary = '上传群文件';
|
||||
override actionDescription = '上传本地文件到指定群聊的文件系统中';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.UploadGroupFile.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.UploadGroupFile.response;
|
||||
|
||||
async _handle (payload: GoCQHTTPUploadGroupFilePayload): Promise<GoCQHTTPUploadGroupFileResponse> {
|
||||
let file = payload.file;
|
||||
|
||||
@ -27,9 +27,11 @@ export default class GoCQHTTPUploadPrivateFile extends OneBotAction<GoCQHTTPUplo
|
||||
override actionName = ActionName.GOCQHTTP_UploadPrivateFile;
|
||||
override payloadSchema = GoCQHTTPUploadPrivateFilePayloadSchema;
|
||||
override returnSchema = GoCQHTTPUploadPrivateFileReturnSchema;
|
||||
override actionDescription = '上传私聊文件';
|
||||
override actionSummary = '上传私聊文件';
|
||||
override actionDescription = '上传本地文件到指定私聊会话中';
|
||||
override actionTags = ['Go-CQHTTP'];
|
||||
override payloadExample = GoCQHTTPActionsExamples.UploadPrivateFile.payload;
|
||||
override returnExample = GoCQHTTPActionsExamples.UploadPrivateFile.response;
|
||||
|
||||
async getPeer (payload: GoCQHTTPUploadPrivateFilePayload): Promise<Peer> {
|
||||
if (payload.user_id) {
|
||||
|
||||
@ -3,7 +3,7 @@ import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { MessageUnique } from 'napcat-common/src/message-unique';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { GroupActionsExamples } from './examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
message_id: Type.Optional(Type.Union([Type.Number(), Type.String()], { description: '消息ID' })),
|
||||
@ -22,9 +22,11 @@ export default class DelEssenceMsg extends OneBotAction<PayloadType, ReturnType>
|
||||
override actionName = ActionName.DelEssenceMsg;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '移出精华消息';
|
||||
override actionSummary = '移出精华消息';
|
||||
override actionDescription = '将一条消息从群精华消息列表中移出';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = ActionExamples.DelEssenceMsg.payload;
|
||||
override payloadExample = GroupActionsExamples.DelEssenceMsg.payload;
|
||||
override returnExample = GroupActionsExamples.DelEssenceMsg.response;
|
||||
|
||||
async _handle (payload: PayloadType): Promise<ReturnType> {
|
||||
// 如果直接提供了 msg_seq, msg_random, group_id,优先使用
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { GroupActionsExamples } from './examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
@ -22,7 +22,8 @@ export class DelGroupNotice extends OneBotAction<PayloadType, ReturnType> {
|
||||
override actionSummary = '删除群公告';
|
||||
override actionDescription = '删除群聊中的公告';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = ActionExamples.DelGroupNotice.payload;
|
||||
override payloadExample = GroupActionsExamples.DelGroupNotice.payload;
|
||||
override returnExample = GroupActionsExamples.DelGroupNotice.response;
|
||||
|
||||
async _handle (payload: PayloadType) {
|
||||
const group = payload.group_id.toString();
|
||||
|
||||
@ -3,8 +3,6 @@ import { GetPacketStatusDepends } from '@/napcat-onebot/action/packet/GetPacketS
|
||||
import { AIVoiceChatType } from 'napcat-core/packet/entities/aiChat';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
character: Type.String({ description: '角色ID' }),
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
@ -21,9 +19,9 @@ export class GetAiRecord extends GetPacketStatusDepends<PayloadType, ReturnType>
|
||||
override actionName = ActionName.GetAiRecord;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '获取AI语音';
|
||||
override actionSummary = '获取AI语音';
|
||||
override actionDescription = '通过AI语音引擎获取指定文本的语音URL';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = ActionExamples.GetAiRecord.payload;
|
||||
|
||||
async _handle (payload: PayloadType) {
|
||||
const rawRsp = await this.core.apis.PacketApi.pkt.operation.GetAiVoice(+payload.group_id, payload.character, payload.text, AIVoiceChatType.Sound);
|
||||
|
||||
@ -2,6 +2,8 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
});
|
||||
@ -23,6 +25,11 @@ export class GetGroupDetailInfo extends OneBotAction<PayloadType, ReturnType> {
|
||||
override actionName = ActionName.GetGroupDetailInfo;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionSummary = '获取群详细信息';
|
||||
override actionDescription = '获取群聊的详细信息,包括成员数、最大成员数等';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = GroupActionsExamples.GetGroupDetailInfo.payload;
|
||||
override returnExample = GroupActionsExamples.GetGroupDetailInfo.response;
|
||||
|
||||
async _handle (payload: PayloadType): Promise<ReturnType> {
|
||||
const data = await this.core.apis.GroupApi.fetchGroupDetail(payload.group_id.toString());
|
||||
|
||||
@ -7,6 +7,8 @@ import { Static, Type } from '@sinclair/typebox';
|
||||
import { NetworkAdapterConfig } from '@/napcat-onebot/config/config';
|
||||
import { OB11MessageData, OB11MessageDataType } from '@/napcat-onebot/types';
|
||||
|
||||
import { GroupActionsExamples } from './examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
});
|
||||
@ -31,6 +33,11 @@ export class GetGroupEssence extends OneBotAction<PayloadType, ReturnType> {
|
||||
override actionName = ActionName.GoCQHTTP_GetEssenceMsg;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionSummary = '获取群精华消息';
|
||||
override actionDescription = '获取指定群聊中的精华消息列表';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = GroupActionsExamples.GetGroupEssence.payload;
|
||||
override returnExample = GroupActionsExamples.GetGroupEssence.response;
|
||||
|
||||
private async msgSeqToMsgId (peer: Peer, msgSeq: string, msgRandom: string) {
|
||||
const replyMsgList = (await this.core.apis.MsgApi.getMsgsBySeqAndCount(peer, msgSeq, 1, true, true)).msgList.find((msg) => msg.msgSeq === msgSeq && msg.msgRandom === msgRandom);
|
||||
|
||||
@ -19,6 +19,9 @@ export class GetGroupIgnoredNotifies extends OneBotAction<PayloadType, ReturnTyp
|
||||
override actionName = ActionName.GetGroupIgnoredNotifies;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionSummary = '获取群忽略通知';
|
||||
override actionDescription = '获取被忽略的入群申请和邀请通知';
|
||||
override actionTags = ['群组接口'];
|
||||
|
||||
async _handle (): Promise<ReturnType> {
|
||||
const SingleScreenNotifies = await this.core.apis.GroupApi.getSingleScreenNotifies(false, 50);
|
||||
|
||||
@ -24,6 +24,7 @@ class GetGroupInfo extends OneBotAction<PayloadType, ReturnType> {
|
||||
override actionDescription = '获取群聊的基本信息';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = GroupActionsExamples.GetGroupInfo.payload;
|
||||
override returnExample = GroupActionsExamples.GetGroupInfo.response;
|
||||
|
||||
async _handle (payload: PayloadType) {
|
||||
const group = (await this.core.apis.GroupApi.getGroups()).find(e => e.groupCode === payload.group_id.toString());
|
||||
|
||||
@ -2,7 +2,7 @@ import { WebApiGroupNoticeFeed } from 'napcat-core';
|
||||
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
import { ActionExamples } from '../examples';
|
||||
import { GroupActionsExamples } from './examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
@ -31,10 +31,11 @@ export class GetGroupNotice extends OneBotAction<PayloadType, ReturnType> {
|
||||
override actionName = ActionName.GoCQHTTP_GetGroupNotice;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '获取群公告';
|
||||
override actionSummary = '获取群公告';
|
||||
override actionDescription = '获取指定群聊中的公告列表';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = ActionExamples.GetGroupNotice.payload;
|
||||
override returnExample = ActionExamples.GetGroupNotice.return;
|
||||
override payloadExample = GroupActionsExamples.GetGroupNotice.payload;
|
||||
override returnExample = GroupActionsExamples.GetGroupNotice.response;
|
||||
|
||||
async _handle (payload: PayloadType) {
|
||||
const group = payload.group_id.toString();
|
||||
|
||||
@ -16,6 +16,9 @@ export class GetGroupShutList extends OneBotAction<PayloadType, ReturnType> {
|
||||
override actionName = ActionName.GetGroupShutList;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionSummary = '获取群禁言列表';
|
||||
override actionDescription = '获取指定群聊中被禁言的成员列表';
|
||||
override actionTags = ['群组接口'];
|
||||
|
||||
async _handle (payload: PayloadType) {
|
||||
return await this.core.apis.GroupApi.getGroupShutUpMemberList(payload.group_id.toString());
|
||||
|
||||
@ -3,8 +3,6 @@ import { GetPacketStatusDepends } from '@/napcat-onebot/action/packet/GetPacketS
|
||||
import { AIVoiceChatType } from 'napcat-core/packet/entities/aiChat';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
character: Type.String({ description: '角色ID' }),
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
@ -23,9 +21,9 @@ export class SendGroupAiRecord extends GetPacketStatusDepends<PayloadType, Retur
|
||||
override actionName = ActionName.SendGroupAiRecord;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '发送群AI语音';
|
||||
override actionSummary = '发送群AI语音';
|
||||
override actionDescription = '在群聊中发送由AI引擎生成的语音';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = ActionExamples.SendGroupAiRecord.payload;
|
||||
|
||||
async _handle (payload: PayloadType) {
|
||||
await this.core.apis.PacketApi.pkt.operation.GetAiVoice(+payload.group_id, payload.character, payload.text, AIVoiceChatType.Sound);
|
||||
|
||||
@ -3,7 +3,7 @@ import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { MessageUnique } from 'napcat-common/src/message-unique';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { GroupActionsExamples } from './examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
message_id: Type.Union([Type.Number(), Type.String()], { description: '消息ID' }),
|
||||
@ -19,9 +19,11 @@ export default class SetEssenceMsg extends OneBotAction<PayloadType, ReturnType>
|
||||
override actionName = ActionName.SetEssenceMsg;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '设置精华消息';
|
||||
override actionSummary = '设置精华消息';
|
||||
override actionDescription = '将一条消息设置为群精华消息';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = ActionExamples.SetEssenceMsg.payload;
|
||||
override payloadExample = GroupActionsExamples.SetEssenceMsg.payload;
|
||||
override returnExample = GroupActionsExamples.SetEssenceMsg.response;
|
||||
|
||||
async _handle (payload: PayloadType) {
|
||||
const msg = MessageUnique.getMsgIdAndPeerByShortId(+payload.message_id);
|
||||
|
||||
@ -3,7 +3,7 @@ import { GroupNotify, NTGroupRequestOperateTypes } from 'napcat-core/types';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { GroupActionsExamples } from './examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
flag: Type.String({ description: '请求flag' }),
|
||||
@ -22,9 +22,11 @@ export default class SetGroupAddRequest extends OneBotAction<PayloadType, Return
|
||||
override actionName = ActionName.SetGroupAddRequest;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '处理加群请求';
|
||||
override actionSummary = '处理加群请求';
|
||||
override actionDescription = '同意或拒绝加群请求或邀请';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = ActionExamples.SetGroupAddRequest.payload;
|
||||
override payloadExample = GroupActionsExamples.SetGroupAddRequest.payload;
|
||||
override returnExample = GroupActionsExamples.SetGroupAddRequest.response;
|
||||
|
||||
async _handle (payload: PayloadType): Promise<null> {
|
||||
const flag = payload.flag.toString();
|
||||
|
||||
@ -3,7 +3,7 @@ import { NTGroupMemberRole } from 'napcat-core/types';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { GroupActionsExamples } from './examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
@ -21,9 +21,11 @@ export default class SetGroupAdmin extends OneBotAction<PayloadType, ReturnType>
|
||||
override actionName = ActionName.SetGroupAdmin;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '设置群管理员';
|
||||
override actionSummary = '设置群管理员';
|
||||
override actionDescription = '设置或取消群聊中的管理员';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = ActionExamples.SetGroupAdmin.payload;
|
||||
override payloadExample = GroupActionsExamples.SetGroupAdmin.payload;
|
||||
override returnExample = GroupActionsExamples.SetGroupAdmin.response;
|
||||
|
||||
async _handle (payload: PayloadType): Promise<null> {
|
||||
const enable = typeof payload.enable === 'string' ? payload.enable === 'true' : !!payload.enable;
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { GroupActionsExamples } from './examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
@ -20,9 +20,11 @@ export default class SetGroupBan extends OneBotAction<PayloadType, ReturnType> {
|
||||
override actionName = ActionName.SetGroupBan;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '群组禁言';
|
||||
override actionSummary = '群组禁言';
|
||||
override actionDescription = '禁言群聊中的指定成员';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = ActionExamples.SetGroupBan.payload;
|
||||
override payloadExample = GroupActionsExamples.SetGroupBan.payload;
|
||||
override returnExample = GroupActionsExamples.SetGroupBan.response;
|
||||
|
||||
async _handle (payload: PayloadType): Promise<null> {
|
||||
const uid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { GroupActionsExamples } from './examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
@ -20,9 +20,11 @@ export default class SetGroupCard extends OneBotAction<PayloadType, ReturnType>
|
||||
override actionName = ActionName.SetGroupCard;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '设置群名片';
|
||||
override actionSummary = '设置群名片';
|
||||
override actionDescription = '设置群聊中指定成员的群名片';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = ActionExamples.SetGroupCard.payload;
|
||||
override payloadExample = GroupActionsExamples.SetGroupCard.payload;
|
||||
override returnExample = GroupActionsExamples.SetGroupCard.response;
|
||||
|
||||
async _handle (payload: PayloadType): Promise<null> {
|
||||
const member = await this.core.apis.GroupApi.getGroupMember(payload.group_id.toString(), payload.user_id.toString());
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { GroupActionsExamples } from './examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
@ -20,9 +20,11 @@ export default class SetGroupKick extends OneBotAction<PayloadType, ReturnType>
|
||||
override actionName = ActionName.SetGroupKick;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '群组踢人';
|
||||
override actionSummary = '群组踢人';
|
||||
override actionDescription = '将指定成员踢出群聊';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = ActionExamples.SetGroupKick.payload;
|
||||
override payloadExample = GroupActionsExamples.SetGroupKick.payload;
|
||||
override returnExample = GroupActionsExamples.SetGroupKick.response;
|
||||
|
||||
async _handle (payload: PayloadType): Promise<null> {
|
||||
const rejectReq = payload.reject_add_request?.toString() === 'true';
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { GroupActionsExamples } from './examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
@ -19,9 +19,11 @@ export default class SetGroupLeave extends OneBotAction<PayloadType, ReturnType>
|
||||
override actionName = ActionName.SetGroupLeave;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '退出群组';
|
||||
override actionSummary = '退出群组';
|
||||
override actionDescription = '退出或解散指定群聊';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = ActionExamples.SetGroupLeave.payload;
|
||||
override payloadExample = GroupActionsExamples.SetGroupLeave.payload;
|
||||
override returnExample = GroupActionsExamples.SetGroupLeave.response;
|
||||
|
||||
async _handle (payload: PayloadType): Promise<null> {
|
||||
await this.core.apis.GroupApi.quitGroup(payload.group_id.toString());
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { GroupActionsExamples } from './examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
@ -19,9 +19,11 @@ export default class SetGroupName extends OneBotAction<PayloadType, ReturnType>
|
||||
override actionName = ActionName.SetGroupName;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '设置群名称';
|
||||
override actionSummary = '设置群名称';
|
||||
override actionDescription = '修改指定群聊的名称';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = ActionExamples.SetGroupName.payload;
|
||||
override payloadExample = GroupActionsExamples.SetGroupName.payload;
|
||||
override returnExample = GroupActionsExamples.SetGroupName.response;
|
||||
|
||||
async _handle (payload: PayloadType): Promise<null> {
|
||||
const ret = await this.core.apis.GroupApi.setGroupName(payload.group_id.toString(), payload.group_name);
|
||||
|
||||
@ -2,7 +2,7 @@ import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||||
import { ActionName } from '@/napcat-onebot/action/router';
|
||||
import { Static, Type } from '@sinclair/typebox';
|
||||
|
||||
import { ActionExamples } from '../examples';
|
||||
import { GroupActionsExamples } from './examples';
|
||||
|
||||
const PayloadSchema = Type.Object({
|
||||
group_id: Type.String({ description: '群号' }),
|
||||
@ -19,9 +19,11 @@ export default class SetGroupWholeBan extends OneBotAction<PayloadType, ReturnTy
|
||||
override actionName = ActionName.SetGroupWholeBan;
|
||||
override payloadSchema = PayloadSchema;
|
||||
override returnSchema = ReturnSchema;
|
||||
override actionDescription = '全员禁言';
|
||||
override actionSummary = '全员禁言';
|
||||
override actionDescription = '开启或关闭指定群聊的全员禁言';
|
||||
override actionTags = ['群组接口'];
|
||||
override payloadExample = ActionExamples.SetGroupWholeBan.payload;
|
||||
override payloadExample = GroupActionsExamples.SetGroupWholeBan.payload;
|
||||
override returnExample = GroupActionsExamples.SetGroupWholeBan.response;
|
||||
|
||||
async _handle (payload: PayloadType): Promise<null> {
|
||||
const enable = payload.enable?.toString() !== 'false';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user