@elizaos/plugin-discord 2.0.0-alpha.1 → 2.0.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/accounts.d.ts +164 -0
  2. package/dist/accounts.d.ts.map +1 -0
  3. package/dist/actions/chatWithAttachments.d.ts +4 -0
  4. package/dist/actions/chatWithAttachments.d.ts.map +1 -0
  5. package/dist/actions/createPoll.d.ts +4 -0
  6. package/dist/actions/createPoll.d.ts.map +1 -0
  7. package/dist/actions/deleteMessage.d.ts +4 -0
  8. package/dist/actions/deleteMessage.d.ts.map +1 -0
  9. package/dist/actions/downloadMedia.d.ts +4 -0
  10. package/dist/actions/downloadMedia.d.ts.map +1 -0
  11. package/dist/actions/editMessage.d.ts +4 -0
  12. package/dist/actions/editMessage.d.ts.map +1 -0
  13. package/dist/actions/getUserInfo.d.ts +4 -0
  14. package/dist/actions/getUserInfo.d.ts.map +1 -0
  15. package/dist/actions/joinChannel.d.ts +4 -0
  16. package/dist/actions/joinChannel.d.ts.map +1 -0
  17. package/dist/actions/leaveChannel.d.ts +4 -0
  18. package/dist/actions/leaveChannel.d.ts.map +1 -0
  19. package/dist/actions/listChannels.d.ts +4 -0
  20. package/dist/actions/listChannels.d.ts.map +1 -0
  21. package/dist/actions/pinMessage.d.ts +4 -0
  22. package/dist/actions/pinMessage.d.ts.map +1 -0
  23. package/dist/actions/reactToMessage.d.ts +4 -0
  24. package/dist/actions/reactToMessage.d.ts.map +1 -0
  25. package/dist/actions/readChannel.d.ts +4 -0
  26. package/dist/actions/readChannel.d.ts.map +1 -0
  27. package/dist/actions/searchMessages.d.ts +4 -0
  28. package/dist/actions/searchMessages.d.ts.map +1 -0
  29. package/dist/actions/sendDM.d.ts +4 -0
  30. package/dist/actions/sendDM.d.ts.map +1 -0
  31. package/dist/actions/sendMessage.d.ts +4 -0
  32. package/dist/actions/sendMessage.d.ts.map +1 -0
  33. package/dist/actions/serverInfo.d.ts +4 -0
  34. package/dist/actions/serverInfo.d.ts.map +1 -0
  35. package/dist/actions/summarizeConversation.d.ts +4 -0
  36. package/dist/actions/summarizeConversation.d.ts.map +1 -0
  37. package/dist/actions/transcribeMedia.d.ts +4 -0
  38. package/dist/actions/transcribeMedia.d.ts.map +1 -0
  39. package/dist/actions/unpinMessage.d.ts +4 -0
  40. package/dist/actions/unpinMessage.d.ts.map +1 -0
  41. package/dist/allowlist.d.ts +198 -0
  42. package/dist/allowlist.d.ts.map +1 -0
  43. package/dist/attachments.d.ts +92 -0
  44. package/dist/attachments.d.ts.map +1 -0
  45. package/dist/banner.d.ts +39 -0
  46. package/dist/banner.d.ts.map +1 -0
  47. package/dist/compat.d.ts +56 -0
  48. package/dist/compat.d.ts.map +1 -0
  49. package/dist/config.d.ts +156 -0
  50. package/dist/config.d.ts.map +1 -0
  51. package/dist/constants.d.ts +2 -0
  52. package/dist/constants.d.ts.map +1 -0
  53. package/dist/environment.d.ts +22 -0
  54. package/dist/environment.d.ts.map +1 -0
  55. package/dist/generated/prompts/typescript/prompts.d.ts +44 -0
  56. package/dist/generated/prompts/typescript/prompts.d.ts.map +1 -0
  57. package/dist/generated/specs/spec-helpers.d.ts +49 -0
  58. package/dist/generated/specs/spec-helpers.d.ts.map +1 -0
  59. package/dist/generated/specs/specs.d.ts +87 -0
  60. package/dist/generated/specs/specs.d.ts.map +1 -0
  61. package/dist/identity.d.ts +4 -0
  62. package/dist/identity.d.ts.map +1 -0
  63. package/dist/index.browser.d.ts +34 -0
  64. package/dist/index.browser.d.ts.map +1 -0
  65. package/dist/index.d.ts.map +1 -0
  66. package/dist/index.js +14175 -0
  67. package/dist/index.js.map +133 -0
  68. package/dist/messages.d.ts +55 -0
  69. package/dist/messages.d.ts.map +1 -0
  70. package/dist/messaging.d.ts +129 -0
  71. package/dist/messaging.d.ts.map +1 -0
  72. package/dist/native-commands.d.ts +142 -0
  73. package/dist/native-commands.d.ts.map +1 -0
  74. package/dist/permissionEvents.d.ts +42 -0
  75. package/dist/permissionEvents.d.ts.map +1 -0
  76. package/dist/permissions.d.ts +36 -0
  77. package/dist/permissions.d.ts.map +1 -0
  78. package/dist/providers/channelState.d.ts +14 -0
  79. package/dist/providers/channelState.d.ts.map +1 -0
  80. package/dist/providers/guildInfo.d.ts +15 -0
  81. package/dist/providers/guildInfo.d.ts.map +1 -0
  82. package/dist/providers/voiceState.d.ts +12 -0
  83. package/dist/providers/voiceState.d.ts.map +1 -0
  84. package/dist/service.d.ts +403 -0
  85. package/dist/service.d.ts.map +1 -0
  86. package/dist/test-setup.d.ts +1 -0
  87. package/dist/test-setup.d.ts.map +1 -0
  88. package/dist/tests.d.ts +123 -0
  89. package/dist/tests.d.ts.map +1 -0
  90. package/dist/types.d.ts +315 -0
  91. package/dist/types.d.ts.map +1 -0
  92. package/dist/utils.d.ts +44 -0
  93. package/dist/utils.d.ts.map +1 -0
  94. package/dist/vitest.config.d.ts +3 -0
  95. package/dist/vitest.config.d.ts.map +1 -0
  96. package/dist/voice.d.ts +230 -0
  97. package/dist/voice.d.ts.map +1 -0
  98. package/package.json +134 -124
@@ -0,0 +1,55 @@
1
+ import { type Media } from "@elizaos/core";
2
+ import { type Message as DiscordMessage } from "discord.js";
3
+ import type { ICompatRuntime } from "./compat";
4
+ import type { IDiscordService } from "./types";
5
+ /**
6
+ * Class representing a Message Manager for handling Discord messages.
7
+ */
8
+ export declare class MessageManager {
9
+ private client;
10
+ private runtime;
11
+ private attachmentManager;
12
+ private getChannelType;
13
+ private discordSettings;
14
+ private discordService;
15
+ /**
16
+ * Constructor for a new instance of MessageManager.
17
+ * @param {IDiscordService} discordService - The Discord service instance.
18
+ * @param {ICompatRuntime} runtime - The agent runtime instance (with cross-core compat).
19
+ * @throws {Error} If the Discord client is not initialized
20
+ */
21
+ constructor(discordService: IDiscordService, runtime: ICompatRuntime);
22
+ /**
23
+ * Check DM access based on the configured dmPolicy.
24
+ *
25
+ * @param message - The Discord DM message
26
+ * @returns Access check result with allowed status and optional reply message
27
+ */
28
+ private checkDmAccess;
29
+ /**
30
+ * Handles incoming Discord messages and processes them accordingly.
31
+ *
32
+ * @param {DiscordMessage} message - The Discord message to be handled
33
+ */
34
+ handleMessage(message: DiscordMessage): Promise<void>;
35
+ /**
36
+ * Processes the message content, mentions, code blocks, attachments, and URLs to generate
37
+ * processed content and media attachments.
38
+ *
39
+ * @param {DiscordMessage} message The message to process
40
+ * @returns {Promise<{ processedContent: string; attachments: Media[] }>} Processed content and media attachments
41
+ */
42
+ processMessage(message: DiscordMessage): Promise<{
43
+ processedContent: string;
44
+ attachments: Media[];
45
+ }>;
46
+ /**
47
+ * Asynchronously fetches the bot's username and discriminator from Discord API.
48
+ *
49
+ * @param {string} botToken The token of the bot to authenticate the request
50
+ * @returns {Promise<string>} A promise that resolves with the bot's username and discriminator
51
+ * @throws {Error} If there is an error while fetching the bot details
52
+ */
53
+ fetchBotName(botToken: string): Promise<string>;
54
+ }
55
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../messages.ts"],"names":[],"mappings":"AAAA,OAAO,EASN,KAAK,KAAK,EAMV,MAAM,eAAe,CAAC;AACvB,OAAO,EAKN,KAAK,OAAO,IAAI,cAAc,EAE9B,MAAM,YAAY,CAAC;AAKpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,KAAK,EAAmB,eAAe,EAAE,MAAM,SAAS,CAAC;AAUhE;;GAEG;AAEH,qBAAa,cAAc;IAC1B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,cAAc,CAA6C;IACnE,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,cAAc,CAAkB;IACxC;;;;;OAKG;gBACS,cAAc,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc;IAqBpE;;;;;OAKG;YACW,aAAa;IAkG3B;;;;OAIG;IACG,aAAa,CAAC,OAAO,EAAE,cAAc;IAue3C;;;;;;OAMG;IACG,cAAc,CACnB,OAAO,EAAE,cAAc,GACrB,OAAO,CAAC;QAAE,gBAAgB,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,KAAK,EAAE,CAAA;KAAE,CAAC;IAoM9D;;;;;;OAMG;IAEG,YAAY,CAAC,QAAQ,EAAE,MAAM;CAoBnC"}
@@ -0,0 +1,129 @@
1
+ import type { Guild, MessageReaction } from "discord.js";
2
+ /**
3
+ * Options for chunking Discord text
4
+ */
5
+ export interface ChunkDiscordTextOpts {
6
+ /** Max characters per Discord message. Default: 2000. */
7
+ maxChars?: number;
8
+ /**
9
+ * Soft max line count per message. Default: 17.
10
+ * Discord clients can clip/collapse very tall messages in the UI.
11
+ */
12
+ maxLines?: number;
13
+ /** Chunking mode: "length" (default) or "newline" */
14
+ chunkMode?: "length" | "newline";
15
+ }
16
+ /**
17
+ * Chunks outbound Discord text by both character count and (soft) line count,
18
+ * while keeping fenced code blocks balanced across chunks.
19
+ */
20
+ export declare function chunkDiscordText(text: string, opts?: ChunkDiscordTextOpts): string[];
21
+ /**
22
+ * Chunks Discord text with configurable chunking mode
23
+ */
24
+ export declare function chunkDiscordTextWithMode(text: string, opts?: ChunkDiscordTextOpts): string[];
25
+ /**
26
+ * Resolves the system location string for logging/display
27
+ */
28
+ export declare function resolveDiscordSystemLocation(params: {
29
+ isDirectMessage: boolean;
30
+ isGroupDm: boolean;
31
+ guild?: Guild | null;
32
+ channelName: string;
33
+ }): string;
34
+ /**
35
+ * Formats a Discord reaction emoji for display
36
+ */
37
+ export declare function formatDiscordReactionEmoji(emoji: {
38
+ id?: string | null;
39
+ name?: string | null;
40
+ }): string;
41
+ /**
42
+ * Formats a Discord reaction emoji from a MessageReaction
43
+ */
44
+ export declare function formatMessageReactionEmoji(reaction: MessageReaction): string;
45
+ /**
46
+ * Formats a Discord user mention
47
+ */
48
+ export declare function formatDiscordUserMention(userId: string): string;
49
+ /**
50
+ * Formats a Discord channel mention
51
+ */
52
+ export declare function formatDiscordChannelMention(channelId: string): string;
53
+ /**
54
+ * Formats a Discord role mention
55
+ */
56
+ export declare function formatDiscordRoleMention(roleId: string): string;
57
+ /**
58
+ * Extracts user ID from a mention string
59
+ */
60
+ export declare function extractUserIdFromMention(mention: string): string | null;
61
+ /**
62
+ * Extracts channel ID from a mention string
63
+ */
64
+ export declare function extractChannelIdFromMention(mention: string): string | null;
65
+ /**
66
+ * Extracts role ID from a mention string
67
+ */
68
+ export declare function extractRoleIdFromMention(mention: string): string | null;
69
+ /**
70
+ * Resolves a timestamp string to milliseconds
71
+ */
72
+ export declare function resolveTimestampMs(timestamp?: string | null): number | undefined;
73
+ /**
74
+ * Formats a timestamp for Discord (Discord timestamp format)
75
+ */
76
+ export declare function formatDiscordTimestamp(timestamp: Date | number, format?: "t" | "T" | "d" | "D" | "f" | "F" | "R"): string;
77
+ /**
78
+ * Strips Discord formatting from text
79
+ */
80
+ export declare function stripDiscordFormatting(text: string): string;
81
+ /**
82
+ * Escapes special Discord markdown characters
83
+ */
84
+ export declare function escapeDiscordMarkdown(text: string): string;
85
+ /**
86
+ * Truncates text to a maximum length with an ellipsis
87
+ */
88
+ export declare function truncateText(text: string, maxLength: number, ellipsis?: string): string;
89
+ /**
90
+ * Truncates text at a UTF-16 boundary safely
91
+ */
92
+ export declare function truncateUtf16Safe(text: string, maxLength: number, ellipsis?: string): string;
93
+ /**
94
+ * Checks if a message mentions a specific user
95
+ */
96
+ export declare function messageContainsMention(text: string, userId: string): boolean;
97
+ /**
98
+ * Extracts all user mentions from a message
99
+ */
100
+ export declare function extractAllUserMentions(text: string): string[];
101
+ /**
102
+ * Extracts all channel mentions from a message
103
+ */
104
+ export declare function extractAllChannelMentions(text: string): string[];
105
+ /**
106
+ * Extracts all role mentions from a message
107
+ */
108
+ export declare function extractAllRoleMentions(text: string): string[];
109
+ /**
110
+ * Sanitizes a thread name for Discord (max 100 chars, no invalid chars)
111
+ */
112
+ export declare function sanitizeThreadName(name: string): string;
113
+ /**
114
+ * Builds a message link URL
115
+ */
116
+ export declare function buildMessageLink(guildId: string, channelId: string, messageId: string): string;
117
+ /**
118
+ * Builds a channel link URL
119
+ */
120
+ export declare function buildChannelLink(guildId: string, channelId: string): string;
121
+ /**
122
+ * Parses a Discord message link URL
123
+ */
124
+ export declare function parseMessageLink(url: string): {
125
+ guildId: string;
126
+ channelId: string;
127
+ messageId: string;
128
+ } | null;
129
+ //# sourceMappingURL=messaging.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messaging.d.ts","sourceRoot":"","sources":["../messaging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,SAAS,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CACjC;AAgJD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,oBAAyB,GAC7B,MAAM,EAAE,CAmHV;AA0BD;;GAEG;AACH,wBAAgB,wBAAwB,CACvC,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,oBAAyB,GAC7B,MAAM,EAAE,CAuBV;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE;IACpD,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,CAYT;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IACjD,EAAE,CAAC,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M,CAKR;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAChC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,QAAQ,SAAM,GACZ,MAAM,CAoBR;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAG5E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAG7D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAGhE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAG7D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOvD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GACf,MAAM,CAER;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC/B,GAAG,EAAE,MAAM,GACT;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAclE"}
@@ -0,0 +1,142 @@
1
+ import { ApplicationCommandOptionType, ButtonStyle, type RESTPostAPIChatInputApplicationCommandsJSONBody } from "discord-api-types/v10";
2
+ /**
3
+ * Command argument definition
4
+ */
5
+ export interface CommandArgDefinition {
6
+ name: string;
7
+ description: string;
8
+ type: "string" | "number" | "boolean";
9
+ required?: boolean;
10
+ choices?: Array<{
11
+ label: string;
12
+ value: string;
13
+ }>;
14
+ }
15
+ /**
16
+ * Native command specification
17
+ */
18
+ export interface NativeCommandSpec {
19
+ name: string;
20
+ description: string;
21
+ acceptsArgs?: boolean;
22
+ args?: CommandArgDefinition[];
23
+ ephemeralDefault?: boolean;
24
+ }
25
+ /**
26
+ * Command argument values
27
+ */
28
+ export type CommandArgValues = Record<string, string | number | boolean>;
29
+ /**
30
+ * Parsed command arguments
31
+ */
32
+ export interface CommandArgs {
33
+ values: CommandArgValues;
34
+ raw?: string;
35
+ }
36
+ /**
37
+ * Result of building command options
38
+ */
39
+ export interface BuiltCommandOption {
40
+ name: string;
41
+ description: string;
42
+ type: ApplicationCommandOptionType;
43
+ required?: boolean;
44
+ choices?: Array<{
45
+ name: string;
46
+ value: string | number;
47
+ }>;
48
+ }
49
+ /**
50
+ * Button specification for argument menus
51
+ */
52
+ export interface CommandArgButton {
53
+ label: string;
54
+ customId: string;
55
+ style: ButtonStyle;
56
+ }
57
+ /**
58
+ * Row of buttons for argument menus
59
+ */
60
+ export interface CommandArgButtonRow {
61
+ buttons: CommandArgButton[];
62
+ }
63
+ /**
64
+ * Argument menu specification
65
+ */
66
+ export interface CommandArgMenu {
67
+ content: string;
68
+ rows: CommandArgButtonRow[];
69
+ }
70
+ /**
71
+ * Key for command argument custom IDs
72
+ */
73
+ export declare const COMMAND_ARG_CUSTOM_ID_KEY = "cmdarg";
74
+ /**
75
+ * Builds Discord command options from argument definitions
76
+ */
77
+ export declare function buildDiscordCommandOptions(args?: CommandArgDefinition[]): BuiltCommandOption[] | undefined;
78
+ /**
79
+ * Builds a complete Discord slash command JSON body
80
+ */
81
+ export declare function buildDiscordSlashCommand(spec: NativeCommandSpec): RESTPostAPIChatInputApplicationCommandsJSONBody;
82
+ /**
83
+ * Encodes a command argument value for use in custom IDs
84
+ */
85
+ export declare function encodeCommandArgValue(value: string): string;
86
+ /**
87
+ * Decodes a command argument value from a custom ID
88
+ */
89
+ export declare function decodeCommandArgValue(value: string): string;
90
+ /**
91
+ * Builds a custom ID for a command argument button
92
+ */
93
+ export declare function buildCommandArgCustomId(params: {
94
+ command: string;
95
+ arg: string;
96
+ value: string;
97
+ userId: string;
98
+ }): string;
99
+ /**
100
+ * Parses command argument data from a custom ID
101
+ */
102
+ export declare function parseCommandArgCustomId(customId: string): {
103
+ command: string;
104
+ arg: string;
105
+ value: string;
106
+ userId: string;
107
+ } | null;
108
+ /**
109
+ * Builds an argument menu with buttons for command selection
110
+ */
111
+ export declare function buildCommandArgMenu(params: {
112
+ commandName: string;
113
+ arg: CommandArgDefinition;
114
+ choices: Array<{
115
+ value: string;
116
+ label: string;
117
+ }>;
118
+ userId: string;
119
+ title?: string;
120
+ buttonsPerRow?: number;
121
+ }): CommandArgMenu;
122
+ /**
123
+ * Checks if an error is a Discord "Unknown Interaction" error
124
+ */
125
+ export declare function isUnknownInteractionError(error: unknown): boolean;
126
+ /**
127
+ * Safely executes a Discord interaction call, catching expired interaction errors
128
+ */
129
+ export declare function safeInteractionCall<T>(fn: () => Promise<T>, onExpired?: () => void): Promise<T | null>;
130
+ /**
131
+ * Creates command arguments from a single value
132
+ */
133
+ export declare function createCommandArgs(argName: string, value: string | number | boolean): CommandArgs;
134
+ /**
135
+ * Serializes command arguments to a string
136
+ */
137
+ export declare function serializeCommandArgs(args?: CommandArgs): string;
138
+ /**
139
+ * Builds the full command text from arguments
140
+ */
141
+ export declare function buildCommandText(commandName: string, args?: CommandArgs): string;
142
+ //# sourceMappingURL=native-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-commands.d.ts","sourceRoot":"","sources":["../native-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,4BAA4B,EAC5B,WAAW,EACX,KAAK,+CAA+C,EACpD,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACtC,QAAQ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GAEG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,EAC1C,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,SAAS,CAAC,EAAE,MAAM,IAAI,GACpB,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAUnB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAChC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAC9B,WAAW,CAIb;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,CAQ/D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC/B,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,WAAW,GAChB,MAAM,CAGR"}
@@ -0,0 +1,42 @@
1
+ import type { IAgentRuntime } from "@elizaos/core";
2
+ import type { AuditLogEvent, Guild, GuildMember, PermissionOverwrites, Role } from "discord.js";
3
+ import type { AuditInfo, PermissionDiff } from "./types";
4
+ /**
5
+ * Permissions that indicate moderation/admin capabilities.
6
+ * Changes to these permissions are considered elevated and worth tracking.
7
+ */
8
+ export declare const ELEVATED_PERMISSIONS: readonly ["Administrator", "ManageGuild", "ManageChannels", "ManageRoles", "KickMembers", "BanMembers", "ModerateMembers", "ManageMessages", "ManageWebhooks", "ManageNicknames", "MuteMembers", "DeafenMembers", "MoveMembers", "ManageEvents", "ManageThreads"];
9
+ /**
10
+ * Check if a role has any elevated (moderation/admin) permissions
11
+ */
12
+ export declare function isElevatedRole(role: Role): boolean;
13
+ /**
14
+ * Check if an array of permission names contains any elevated permissions
15
+ */
16
+ export declare function hasElevatedPermissions(permissions: string[]): boolean;
17
+ /**
18
+ * Fetch the most recent matching audit log entry for an action.
19
+ * Matches by target ID and filters to entries within 10 seconds.
20
+ * Returns null gracefully on errors (rate limits, missing permissions, etc.)
21
+ */
22
+ export declare function fetchAuditEntry(guild: Guild, actionType: AuditLogEvent, target: string, runtime: IAgentRuntime): Promise<AuditInfo | null>;
23
+ /**
24
+ * Diff two permission overwrites and determine what changed.
25
+ * Returns the list of changes and the action type (CREATE/UPDATE/DELETE).
26
+ */
27
+ export declare function diffOverwrites(oldOw: PermissionOverwrites | undefined | null, newOw: PermissionOverwrites | undefined | null): {
28
+ changes: PermissionDiff[];
29
+ action: "CREATE" | "UPDATE" | "DELETE";
30
+ };
31
+ /**
32
+ * Diff two role permission sets and return what changed.
33
+ */
34
+ export declare function diffRolePermissions(oldRole: Role, newRole: Role): PermissionDiff[];
35
+ /**
36
+ * Diff member roles to find added and removed roles.
37
+ */
38
+ export declare function diffMemberRoles(oldMember: GuildMember, newMember: GuildMember): {
39
+ added: Role[];
40
+ removed: Role[];
41
+ };
42
+ //# sourceMappingURL=permissionEvents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissionEvents.d.ts","sourceRoot":"","sources":["../permissionEvents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EACX,aAAa,EACb,KAAK,EACL,WAAW,EACX,oBAAoB,EACpB,IAAI,EACJ,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAmB,MAAM,SAAS,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,oBAAoB,mQAgBvB,CAAC;AAEX;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAElD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAIrE;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACpC,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,aAAa,EACzB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,aAAa,GACpB,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAuB3B;AA8CD;;;GAGG;AACH,wBAAgB,cAAc,CAC7B,KAAK,EAAE,oBAAoB,GAAG,SAAS,GAAG,IAAI,EAC9C,KAAK,EAAE,oBAAoB,GAAG,SAAS,GAAG,IAAI,GAC5C;IAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;CAAE,CAmCvE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,GACX,cAAc,EAAE,CAoBlB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC9B,SAAS,EAAE,WAAW,EACtB,SAAS,EAAE,WAAW,GACpB;IAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAAC,OAAO,EAAE,IAAI,EAAE,CAAA;CAAE,CAQpC"}
@@ -0,0 +1,36 @@
1
+ export declare const PERMISSIONS_BASIC: bigint;
2
+ export declare const PERMISSIONS_BASIC_VOICE: bigint;
3
+ export declare const PERMISSIONS_MODERATOR: bigint;
4
+ export declare const PERMISSIONS_MODERATOR_VOICE: bigint;
5
+ export declare const PERMISSIONS_ADMIN: bigint;
6
+ export declare const PERMISSIONS_ADMIN_VOICE: bigint;
7
+ export declare const DiscordPermissionTiers: {
8
+ readonly BASIC: number;
9
+ readonly BASIC_VOICE: number;
10
+ readonly MODERATOR: number;
11
+ readonly MODERATOR_VOICE: number;
12
+ readonly ADMIN: number;
13
+ readonly ADMIN_VOICE: number;
14
+ };
15
+ export type DiscordPermissionTier = keyof typeof DiscordPermissionTiers;
16
+ export declare function generateInviteUrl(applicationId: string, tier?: DiscordPermissionTier): string;
17
+ export interface DiscordPermissionValues {
18
+ basic: number;
19
+ basicVoice: number;
20
+ moderator: number;
21
+ moderatorVoice: number;
22
+ admin: number;
23
+ adminVoice: number;
24
+ }
25
+ export declare function getPermissionValues(): DiscordPermissionValues;
26
+ export interface DiscordInviteUrls {
27
+ basic: string;
28
+ basicVoice: string;
29
+ moderator: string;
30
+ moderatorVoice: string;
31
+ admin: string;
32
+ adminVoice: string;
33
+ }
34
+ export declare function generateAllInviteUrls(applicationId: string): DiscordInviteUrls;
35
+ export declare const REQUIRED_PERMISSIONS: bigint;
36
+ //# sourceMappingURL=permissions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../permissions.ts"],"names":[],"mappings":"AAqFA,eAAO,MAAM,iBAAiB,QAAa,CAAC;AAC5C,eAAO,MAAM,uBAAuB,QAA2B,CAAC;AAChE,eAAO,MAAM,qBAAqB,QAAiB,CAAC;AACpD,eAAO,MAAM,2BAA2B,QAA+B,CAAC;AACxE,eAAO,MAAM,iBAAiB,QAAa,CAAC;AAC5C,eAAO,MAAM,uBAAuB,QAAiC,CAAC;AAEtE,eAAO,MAAM,sBAAsB;;;;;;;CAOzB,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAAG,MAAM,OAAO,sBAAsB,CAAC;AAExE,wBAAgB,iBAAiB,CAChC,aAAa,EAAE,MAAM,EACrB,IAAI,GAAE,qBAAyC,GAC7C,MAAM,CAGR;AAED,MAAM,WAAW,uBAAuB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,mBAAmB,IAAI,uBAAuB,CAS7D;AAED,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,qBAAqB,CACpC,aAAa,EAAE,MAAM,GACnB,iBAAiB,CASnB;AAED,eAAO,MAAM,oBAAoB,QAA8B,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { Provider } from "@elizaos/core";
2
+ /**
3
+ * Represents a provider for retrieving channel state information.
4
+ * @type {Provider}
5
+ * @property {string} name - The name of the channel state provider.
6
+ * @property {Function} get - Asynchronous function that retrieves channel state information based on the provided runtime, message, and optional state parameters.
7
+ * @param {IAgentRuntime} runtime - The agent runtime.
8
+ * @param {Memory} message - The message object.
9
+ * @param {State} [state] - Optional state object.
10
+ * @returns {Promise<Object>} A promise that resolves to an object containing channel state data, values, and text.
11
+ */
12
+ export declare const channelStateProvider: Provider;
13
+ export default channelStateProvider;
14
+ //# sourceMappingURL=channelState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channelState.d.ts","sourceRoot":"","sources":["../../providers/channelState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,QAAQ,EAAS,MAAM,eAAe,CAAC;AAS5E;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAoJlC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { Provider } from "@elizaos/core";
2
+ /**
3
+ * Represents a provider for retrieving guild/server information.
4
+ * @type {Provider}
5
+ * @property {string} name - The name of the guild info provider.
6
+ * @property {Function} get - Asynchronous function that retrieves guild information
7
+ * based on the provided runtime, message, and optional state parameters.
8
+ * @param {IAgentRuntime} runtime - The agent runtime.
9
+ * @param {Memory} message - The message object.
10
+ * @param {State} [state] - Optional state object.
11
+ * @returns {Promise<Object>} A promise that resolves to an object containing guild data, values, and text.
12
+ */
13
+ export declare const guildInfoProvider: Provider;
14
+ export default guildInfoProvider;
15
+ //# sourceMappingURL=guildInfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guildInfo.d.ts","sourceRoot":"","sources":["../../providers/guildInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,QAAQ,EAAS,MAAM,eAAe,CAAC;AAQ5E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAyG/B,CAAC;AA4HF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Provider } from "@elizaos/core";
2
+ /**
3
+ * Provides information about the voice state of the user, including whether they are currently in a voice channel.
4
+ *
5
+ * @param {IAgentRuntime} runtime - The runtime object for the agent
6
+ * @param {Memory} message - The message object containing room ID
7
+ * @param {State} [state] - Optional state object for the user
8
+ * @returns {Object} An object containing information about the voice state of the user
9
+ */
10
+ export declare const voiceStateProvider: Provider;
11
+ export default voiceStateProvider;
12
+ //# sourceMappingURL=voiceState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voiceState.d.ts","sourceRoot":"","sources":["../../providers/voiceState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGX,QAAQ,EAIR,MAAM,eAAe,CAAC;AASvB;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,QA2JhC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}