/** * Discord Endpoint 实现 (Gateway) */ import { Client, Message as DiscordMessage, TextChannel, DMChannel, NewsChannel, ThreadChannel, EmbedBuilder, AttachmentBuilder, MessageCreateOptions, ChatInputCommandInteraction } from "discord.js"; import { Endpoint, Message, SendOptions, SendContent, MessageSegment } from 'zhin.js'; import type { DiscordGatewayConfig, DiscordChannelMessage } from "./types.js"; import type { DiscordAdapter } from "./adapter.js"; export declare class DiscordEndpoint extends Client implements Endpoint { adapter: DiscordAdapter; $config: DiscordGatewayConfig; private slashCommandHandlers; /** message_id -> channel_id,用于在仅有 message_id 的场景执行 reaction 操作 */ private readonly messageChannelMap; $connected: boolean; get pluginLogger(): import("zhin.js").Logger; get $id(): string; constructor(adapter: DiscordAdapter, $config: DiscordGatewayConfig); private handleDiscordMessage; private handleSlashCommand; $connect(): Promise; $disconnect(): Promise; $formatMessage(msg: DiscordChannelMessage): Message; parseMessageContent(msg: DiscordChannelMessage): MessageSegment[]; parseTextContent(content: string, msg: DiscordChannelMessage): MessageSegment[]; parseAttachment(attachment: any): MessageSegment[]; $sendMessage(options: SendOptions): Promise; sendContentToChannel(channel: TextChannel | DMChannel | NewsChannel | ThreadChannel, content: SendContent, extraOptions?: MessageCreateOptions): Promise>; $recallMessage(id: string): Promise; /** * 踢出成员 * @param guildId 服务器 ID * @param userId 用户 ID * @param reason 原因 */ kickMember(guildId: string, userId: string, reason?: string): Promise; /** * 封禁成员 * @param guildId 服务器 ID * @param userId 用户 ID * @param reason 原因 * @param deleteMessageDays 删除消息天数 */ banMember(guildId: string, userId: string, reason?: string, deleteMessageDays?: number): Promise; /** * 解除封禁 * @param guildId 服务器 ID * @param userId 用户 ID * @param reason 原因 */ unbanMember(guildId: string, userId: string, reason?: string): Promise; /** * 超时(禁言)成员 * @param guildId 服务器 ID * @param userId 用户 ID * @param duration 超时时长(秒),0 表示取消超时 * @param reason 原因 */ timeoutMember(guildId: string, userId: string, duration?: number, reason?: string): Promise; /** * 修改成员昵称 * @param guildId 服务器 ID * @param userId 用户 ID * @param nickname 新昵称 */ setNickname(guildId: string, userId: string, nickname: string): Promise; /** * 添加角色 * @param guildId 服务器 ID * @param userId 用户 ID * @param roleId 角色 ID */ addRole(guildId: string, userId: string, roleId: string): Promise; /** * 移除角色 * @param guildId 服务器 ID * @param userId 用户 ID * @param roleId 角色 ID */ removeRole(guildId: string, userId: string, roleId: string): Promise; /** * 获取服务器角色列表 * @param guildId 服务器 ID */ getRoles(guildId: string): Promise; /** * 获取成员列表 * @param guildId 服务器 ID * @param limit 数量限制 */ getMembers(guildId: string, limit?: number): Promise; /** * 获取服务器信息 * @param guildId 服务器 ID */ getGuildInfo(guildId: string): Promise; createThread(channelId: string, name: string, messageId?: string, autoArchiveDuration?: number): Promise; addReaction(channelId: string, messageId: string, emoji: string): Promise; private resolveDiscordMessageRef; $addReaction(messageId: string, emoji: string): Promise; $removeReaction(messageId: string, reactionId: string): Promise; sendEmbed(channelId: string, embedData: { title?: string; description?: string; color?: number; url?: string; fields?: { name: string; value: string; inline?: boolean; }[]; }): Promise>; createForumPost(channelId: string, name: string, content: string, tags?: string[]): Promise; handleFileSegment(data: any, files: AttachmentBuilder[], textContent: string): Promise; createEmbedFromData(data: any): EmbedBuilder; private getActivityType; private registerSlashCommands; addSlashCommandHandler(commandName: string, handler: (interaction: ChatInputCommandInteraction) => Promise): void; removeSlashCommandHandler(commandName: string): boolean; private fileExists; static formatContentToText(content: SendContent): string; } //# sourceMappingURL=endpoint.d.ts.map