import type { CommonTypes } from "./types.js"; declare module "./adapter.js" { /** * 通用适配器 API 的参数与返回值契约。 * * 该命名空间只承载静态类型;运行时能力由 AdapterCapabilityManifest 描述, * 避免“类型中存在方法”被误解为“平台原生支持该方法”。 */ namespace Adapter { interface Configs extends Record { } type VerificationBlock = { type: "image"; base64: string; alt?: string; } | { type: "image_url"; url: string; alt?: string; } | { type: "qrcode"; content: string; alt?: string; } | { type: "link"; url: string; label?: string; } | { type: "text"; content: string; } /** 保留原始 JSON 字段;展示层可以独立格式化及复制。 */ | { type: "json"; content: Record; label?: string; } | { type: "input"; key: string; placeholder?: string; maxLength?: number; secret?: boolean; }; interface VerificationRequestOptions { blocks?: VerificationBlock[]; } /** 验证面板快捷操作按钮(如「重新登录」) */ interface VerificationAction { id: string; label: string; /** 默认 secondary;primary 使用主按钮样式 */ variant?: "primary" | "secondary"; } interface VerificationRequest { platform: string; account_id: string; type: string; hint: string; options?: VerificationRequestOptions; requestSmsAvailable?: boolean; /** 为 true 时前端显示「确认」按钮(无需输入的验证,如扫码/身份验证后继续登录) */ confirmable?: boolean; /** 「确认」按钮文案,默认「已完成,继续登录」 */ confirmLabel?: string; /** 额外快捷操作;点击后经 submitVerification 提交 data.action = id */ actions?: VerificationAction[]; data?: Record; request_id?: string; } /** 清除待处理验证(登录成功 / 重新登录前),type 省略则清除该账号全部 */ interface VerificationClear { platform: string; account_id: string; type?: string; } interface SendMessageParams { scene_type: CommonTypes.Scene; scene_id: CommonTypes.Id; /** channel 场景的所属服务器/工作区。 */ guild_id?: CommonTypes.Id; message: CommonTypes.Segment[]; } interface SendMessageResult { message_id: CommonTypes.Id; /** 平台确认的规范化会话身份;仅在与入站事件可一致匹配时提供。 */ scene?: Pick; } interface DeleteMessageParams { message_id: CommonTypes.Id; scene_type?: CommonTypes.Scene; scene_id?: CommonTypes.Id; } interface GetMessageParams { message_id: CommonTypes.Id; scene_type?: CommonTypes.Scene; scene_id?: CommonTypes.Id; } interface GetMessageHistoryParams { scene_type: CommonTypes.Scene; scene_id: CommonTypes.Id; limit?: number; offset?: number; start_message_id?: CommonTypes.Id; } interface UpdateMessageParams { message_id: CommonTypes.Id; message: CommonTypes.Segment[]; } interface GetForwardMessageParams { message_id?: CommonTypes.Id; resource_id?: string; } interface MarkMessageAsReadParams { scene_type: CommonTypes.Scene; scene_id: CommonTypes.Id; message_id?: CommonTypes.Id; } interface MessageSender { scene_type: CommonTypes.Scene; sender_id: CommonTypes.Id; scene_id: CommonTypes.Id; sender_name: string; scene_name: string; } interface MessageInfo { message_id: CommonTypes.Id; time: number; sender: MessageSender; message: CommonTypes.Segment[]; } interface GetUserInfoParams { user_id: CommonTypes.Id; no_cache?: boolean; } interface CreateUserChannelParams { user_id: CommonTypes.Id; guild_id?: CommonTypes.Id; } interface SetAvatarParams { source: string; } interface SetNicknameParams { nickname: string; } interface SetBioParams { bio: string; } interface UserInfo { user_id: CommonTypes.Id; user_name: string; user_displayname?: string; avatar?: string; qid?: string; age?: number; sex?: "male" | "female" | "unknown"; remark?: string; bio?: string; level?: number; area?: string; country?: string; city?: string; school?: string; } interface GetFriendListParams { no_cache?: boolean; } interface GetFriendInfoParams { user_id: CommonTypes.Id; no_cache?: boolean; } interface DeleteFriendParams { user_id: CommonTypes.Id; /** 删除好友后同时加入黑名单;不支持该语义的平台必须显式拒绝 true。 */ block?: boolean; } interface SendFriendNudgeParams { user_id: CommonTypes.Id; is_self?: boolean; } interface SendLikeParams { user_id: CommonTypes.Id; times?: number; count?: number; } interface GetFriendRequestsParams { limit?: number; is_filtered?: boolean; } interface HandleFriendRequestParams { request_id?: CommonTypes.Id; flag?: string; initiator_uid?: string; is_filtered?: boolean; approve: boolean; remark?: string; reason?: string; /** 拒绝申请时同时加入黑名单;不支持该语义的平台必须显式拒绝 true。 */ block?: boolean; } interface FriendInfo { user_id: CommonTypes.Id; user_name: string; remark?: string; sex?: "male" | "female" | "unknown"; qid?: string; category_id?: number; category_name?: string; } interface FriendRequest { request_id: CommonTypes.Id; user_id: CommonTypes.Id; user_name: string; message?: string; time: number; initiator_uid?: string; target_user_id?: CommonTypes.Id; target_user_uid?: string; state?: "pending" | "accepted" | "rejected" | "ignored"; via?: string; is_filtered?: boolean; } interface GetGroupListParams { no_cache?: boolean; } interface GetGroupInfoParams { group_id: CommonTypes.Id; no_cache?: boolean; } interface SetGroupNameParams { group_id: CommonTypes.Id; group_name: string; } interface LeaveGroupParams { group_id: CommonTypes.Id; is_dismiss?: boolean; } interface GetGroupMemberListParams { group_id: CommonTypes.Id; no_cache?: boolean; } interface GetGroupMemberInfoParams { group_id: CommonTypes.Id; user_id: CommonTypes.Id; no_cache?: boolean; } interface KickGroupMemberParams { group_id: CommonTypes.Id; user_id: CommonTypes.Id; reject_add_request?: boolean; } interface InviteGroupMemberParams { group_id: CommonTypes.Id; user_id: CommonTypes.Id; } interface MuteGroupMemberParams { group_id: CommonTypes.Id; user_id: CommonTypes.Id; duration: number; } interface MuteGroupAllParams { group_id: CommonTypes.Id; enable: boolean; } interface MuteGroupAnonymousParams { group_id: CommonTypes.Id; flag: string; duration: number; } interface SetGroupAnonymousParams { group_id: CommonTypes.Id; enable: boolean; } interface SetGroupAdminParams { group_id: CommonTypes.Id; user_id: CommonTypes.Id; enable: boolean; } interface SetGroupCardParams { group_id: CommonTypes.Id; user_id: CommonTypes.Id; card: string; } interface SetGroupSpecialTitleParams { group_id: CommonTypes.Id; user_id: CommonTypes.Id; special_title: string; duration?: number; } interface GetGroupHonorInfoParams { group_id: CommonTypes.Id; type: "talkative" | "performer" | "legend" | "strong_newbie" | "emotion" | "all"; } interface SendGroupNudgeParams { group_id: CommonTypes.Id; user_id: CommonTypes.Id; } interface HandleGroupRequestParams { request_id?: CommonTypes.Id; flag?: string; group_id?: CommonTypes.Id; is_filtered?: boolean; sub_type?: "add" | "invite"; type: "request" | "invitation"; approve: boolean; reason?: string; /** 拒绝申请时同时阻止后续申请;不支持该语义的平台必须显式拒绝 true。 */ block?: boolean; } interface GetGroupNotificationsParams { start_notification_id?: CommonTypes.Id; is_filtered?: boolean; limit?: number; } interface SetGroupAvatarParams { group_id: CommonTypes.Id; file: string; } interface SendGroupMessageReactionParams { group_id: CommonTypes.Id; message_id: CommonTypes.Id; reaction: string; reaction_type: "face" | "emoji"; is_add: boolean; } interface GroupInfo { group_id: CommonTypes.Id; group_name: string; member_count?: number; max_member_count?: number; remark?: string; created_time?: number; description?: string; question?: string; announcement?: string; } interface GroupMemberInfo { group_id: CommonTypes.Id; user_id: CommonTypes.Id; user_name: string; card?: string; sex?: "male" | "female" | "unknown"; age?: number; area?: string; level?: number; role?: "owner" | "admin" | "member"; join_time?: number; last_sent_time?: number; title?: string; title_expire_time?: number; shut_up_end_time?: number; } interface HonorMember { user_id: CommonTypes.Id; user_name: string; avatar?: string; description?: string; } interface GroupHonorInfo { group_id: CommonTypes.Id; current_talkative?: HonorMember; talkative_list?: HonorMember[]; performer_list?: HonorMember[]; legend_list?: HonorMember[]; strong_newbie_list?: HonorMember[]; emotion_list?: HonorMember[]; } interface GroupNotificationBase { notification_id: CommonTypes.Id; group_id: CommonTypes.Id; is_filtered: boolean; state: "pending" | "accepted" | "rejected" | "ignored"; operator_id?: CommonTypes.Id; } interface GroupJoinRequestNotification extends GroupNotificationBase { type: "join_request"; initiator_id: CommonTypes.Id; comment: string; } interface GroupInvitedJoinRequestNotification extends GroupNotificationBase { type: "invited_join_request"; initiator_id: CommonTypes.Id; target_user_id: CommonTypes.Id; } type GroupNotification = GroupJoinRequestNotification | GroupInvitedJoinRequestNotification; interface GroupNotificationsResult { notifications: GroupNotification[]; next_notification_id?: CommonTypes.Id; } } } export {};