popii-framework 0.6.1-beta.0

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 (177) hide show
  1. package/README.md +159 -0
  2. package/dist/cli/commands.d.ts +15 -0
  3. package/dist/cli/commands.d.ts.map +1 -0
  4. package/dist/cli/pages.d.ts +5 -0
  5. package/dist/cli/pages.d.ts.map +1 -0
  6. package/dist/cli/scaffold.d.ts +23 -0
  7. package/dist/cli/scaffold.d.ts.map +1 -0
  8. package/dist/cli.d.ts +3 -0
  9. package/dist/cli.d.ts.map +1 -0
  10. package/dist/cli.js +1710 -0
  11. package/dist/client.d.ts +40 -0
  12. package/dist/client.d.ts.map +1 -0
  13. package/dist/define/command.d.ts +47 -0
  14. package/dist/define/command.d.ts.map +1 -0
  15. package/dist/define/event.d.ts +52 -0
  16. package/dist/define/event.d.ts.map +1 -0
  17. package/dist/define/snap.d.ts +55 -0
  18. package/dist/define/snap.d.ts.map +1 -0
  19. package/dist/define/task.d.ts +64 -0
  20. package/dist/define/task.d.ts.map +1 -0
  21. package/dist/handler/cache.d.ts +6 -0
  22. package/dist/handler/cache.d.ts.map +1 -0
  23. package/dist/handler/context.d.ts +3 -0
  24. package/dist/handler/context.d.ts.map +1 -0
  25. package/dist/handler/index.d.ts +8 -0
  26. package/dist/handler/index.d.ts.map +1 -0
  27. package/dist/handler/interaction.d.ts +4 -0
  28. package/dist/handler/interaction.d.ts.map +1 -0
  29. package/dist/handler/lock.d.ts +2 -0
  30. package/dist/handler/lock.d.ts.map +1 -0
  31. package/dist/handler/logger.d.ts +4 -0
  32. package/dist/handler/logger.d.ts.map +1 -0
  33. package/dist/handler/message.d.ts +4 -0
  34. package/dist/handler/message.d.ts.map +1 -0
  35. package/dist/handler/middleware.d.ts +5 -0
  36. package/dist/handler/middleware.d.ts.map +1 -0
  37. package/dist/index.d.ts +31 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +10464 -0
  40. package/dist/loader/fizz.d.ts +2 -0
  41. package/dist/loader/fizz.d.ts.map +1 -0
  42. package/dist/loader/index.d.ts +3 -0
  43. package/dist/loader/index.d.ts.map +1 -0
  44. package/dist/loader/locales.d.ts +2 -0
  45. package/dist/loader/locales.d.ts.map +1 -0
  46. package/dist/loader/middleware.d.ts +54 -0
  47. package/dist/loader/middleware.d.ts.map +1 -0
  48. package/dist/loader/snaps.d.ts +3 -0
  49. package/dist/loader/snaps.d.ts.map +1 -0
  50. package/dist/loader/tasks.d.ts +3 -0
  51. package/dist/loader/tasks.d.ts.map +1 -0
  52. package/dist/plugins/activity.d.ts +15 -0
  53. package/dist/plugins/activity.d.ts.map +1 -0
  54. package/dist/plugins/ai.d.ts +35 -0
  55. package/dist/plugins/ai.d.ts.map +1 -0
  56. package/dist/plugins/automod.d.ts +12 -0
  57. package/dist/plugins/automod.d.ts.map +1 -0
  58. package/dist/plugins/canvas.d.ts +75 -0
  59. package/dist/plugins/canvas.d.ts.map +1 -0
  60. package/dist/plugins/captcha.d.ts +20 -0
  61. package/dist/plugins/captcha.d.ts.map +1 -0
  62. package/dist/plugins/commandAnalytic.d.ts +8 -0
  63. package/dist/plugins/commandAnalytic.d.ts.map +1 -0
  64. package/dist/plugins/commandLogger.d.ts +13 -0
  65. package/dist/plugins/commandLogger.d.ts.map +1 -0
  66. package/dist/plugins/desk.d.ts +23 -0
  67. package/dist/plugins/desk.d.ts.map +1 -0
  68. package/dist/plugins/economy.d.ts +41 -0
  69. package/dist/plugins/economy.d.ts.map +1 -0
  70. package/dist/plugins/errorHandler.d.ts +8 -0
  71. package/dist/plugins/errorHandler.d.ts.map +1 -0
  72. package/dist/plugins/giveaway.d.ts +21 -0
  73. package/dist/plugins/giveaway.d.ts.map +1 -0
  74. package/dist/plugins/lastfm.d.ts +24 -0
  75. package/dist/plugins/lastfm.d.ts.map +1 -0
  76. package/dist/plugins/mongoose.d.ts +23 -0
  77. package/dist/plugins/mongoose.d.ts.map +1 -0
  78. package/dist/plugins/pay.d.ts +24 -0
  79. package/dist/plugins/pay.d.ts.map +1 -0
  80. package/dist/plugins/permissionGuard.d.ts +8 -0
  81. package/dist/plugins/permissionGuard.d.ts.map +1 -0
  82. package/dist/plugins/reload.d.ts +8 -0
  83. package/dist/plugins/reload.d.ts.map +1 -0
  84. package/dist/plugins/sqlite.d.ts +20 -0
  85. package/dist/plugins/sqlite.d.ts.map +1 -0
  86. package/dist/plugins/telemetry.d.ts +11 -0
  87. package/dist/plugins/telemetry.d.ts.map +1 -0
  88. package/dist/plugins/ui.d.ts +60 -0
  89. package/dist/plugins/ui.d.ts.map +1 -0
  90. package/dist/plugins/voice/player.d.ts +9 -0
  91. package/dist/plugins/voice/player.d.ts.map +1 -0
  92. package/dist/plugins/voice/resolver.d.ts +16 -0
  93. package/dist/plugins/voice/resolver.d.ts.map +1 -0
  94. package/dist/plugins/voice/setup.d.ts +11 -0
  95. package/dist/plugins/voice/setup.d.ts.map +1 -0
  96. package/dist/plugins/voice/sponsorblock.d.ts +17 -0
  97. package/dist/plugins/voice/sponsorblock.d.ts.map +1 -0
  98. package/dist/plugins/voice/state.d.ts +35 -0
  99. package/dist/plugins/voice/state.d.ts.map +1 -0
  100. package/dist/plugins/voice/types.d.ts +14 -0
  101. package/dist/plugins/voice/types.d.ts.map +1 -0
  102. package/dist/plugins/voice/utils.d.ts +14 -0
  103. package/dist/plugins/voice/utils.d.ts.map +1 -0
  104. package/dist/plugins/voice.d.ts +72 -0
  105. package/dist/plugins/voice.d.ts.map +1 -0
  106. package/dist/plugins/web/helpers.d.ts +17 -0
  107. package/dist/plugins/web/helpers.d.ts.map +1 -0
  108. package/dist/plugins/web/index.d.ts +16 -0
  109. package/dist/plugins/web/index.d.ts.map +1 -0
  110. package/dist/plugins/web/routes/auth.d.ts +3 -0
  111. package/dist/plugins/web/routes/auth.d.ts.map +1 -0
  112. package/dist/plugins/web/routes/dashboard.d.ts +3 -0
  113. package/dist/plugins/web/routes/dashboard.d.ts.map +1 -0
  114. package/dist/plugins/web/routes/database.d.ts +3 -0
  115. package/dist/plugins/web/routes/database.d.ts.map +1 -0
  116. package/dist/plugins/web/routes/locales.d.ts +3 -0
  117. package/dist/plugins/web/routes/locales.d.ts.map +1 -0
  118. package/dist/plugins/web/routes/members.d.ts +3 -0
  119. package/dist/plugins/web/routes/members.d.ts.map +1 -0
  120. package/dist/plugins/web/routes/metrics.d.ts +7 -0
  121. package/dist/plugins/web/routes/metrics.d.ts.map +1 -0
  122. package/dist/plugins/web/routes/music.d.ts +3 -0
  123. package/dist/plugins/web/routes/music.d.ts.map +1 -0
  124. package/dist/plugins/web/routes/servers.d.ts +3 -0
  125. package/dist/plugins/web/routes/servers.d.ts.map +1 -0
  126. package/dist/plugins/web/routes/tasks.d.ts +3 -0
  127. package/dist/plugins/web/routes/tasks.d.ts.map +1 -0
  128. package/dist/plugins/web/routes/ui-editor.d.ts +3 -0
  129. package/dist/plugins/web/routes/ui-editor.d.ts.map +1 -0
  130. package/dist/plugins/web/setup.d.ts +7 -0
  131. package/dist/plugins/web/setup.d.ts.map +1 -0
  132. package/dist/plugins/web/types.d.ts +60 -0
  133. package/dist/plugins/web/types.d.ts.map +1 -0
  134. package/dist/plugins/web/views/admin.d.ts +5 -0
  135. package/dist/plugins/web/views/admin.d.ts.map +1 -0
  136. package/dist/plugins/web/views/base.d.ts +13 -0
  137. package/dist/plugins/web/views/base.d.ts.map +1 -0
  138. package/dist/plugins/web/views/commands.d.ts +2 -0
  139. package/dist/plugins/web/views/commands.d.ts.map +1 -0
  140. package/dist/plugins/web/views/dashboard.d.ts +32 -0
  141. package/dist/plugins/web/views/dashboard.d.ts.map +1 -0
  142. package/dist/plugins/web/views/database.d.ts +2 -0
  143. package/dist/plugins/web/views/database.d.ts.map +1 -0
  144. package/dist/plugins/web/views/home.d.ts +2 -0
  145. package/dist/plugins/web/views/home.d.ts.map +1 -0
  146. package/dist/plugins/web/views/index.d.ts +16 -0
  147. package/dist/plugins/web/views/index.d.ts.map +1 -0
  148. package/dist/plugins/web/views/invite.d.ts +2 -0
  149. package/dist/plugins/web/views/invite.d.ts.map +1 -0
  150. package/dist/plugins/web/views/lastfm.d.ts +2 -0
  151. package/dist/plugins/web/views/lastfm.d.ts.map +1 -0
  152. package/dist/plugins/web/views/locales.d.ts +2 -0
  153. package/dist/plugins/web/views/locales.d.ts.map +1 -0
  154. package/dist/plugins/web/views/members.d.ts +6 -0
  155. package/dist/plugins/web/views/members.d.ts.map +1 -0
  156. package/dist/plugins/web/views/music.d.ts +5 -0
  157. package/dist/plugins/web/views/music.d.ts.map +1 -0
  158. package/dist/plugins/web/views/servers.d.ts +3 -0
  159. package/dist/plugins/web/views/servers.d.ts.map +1 -0
  160. package/dist/plugins/web/views/terminal.d.ts +2 -0
  161. package/dist/plugins/web/views/terminal.d.ts.map +1 -0
  162. package/dist/plugins/web/views/ui-editor.d.ts +2 -0
  163. package/dist/plugins/web/views/ui-editor.d.ts.map +1 -0
  164. package/dist/types.d.ts +671 -0
  165. package/dist/types.d.ts.map +1 -0
  166. package/dist/utils/error.d.ts +62 -0
  167. package/dist/utils/error.d.ts.map +1 -0
  168. package/dist/utils/help.d.ts +3 -0
  169. package/dist/utils/help.d.ts.map +1 -0
  170. package/dist/utils/logger.d.ts +1 -0
  171. package/dist/utils/logger.d.ts.map +1 -0
  172. package/dist/utils/sharding.d.ts +17 -0
  173. package/dist/utils/sharding.d.ts.map +1 -0
  174. package/dist/utils/testing.d.ts +42 -0
  175. package/dist/utils/testing.d.ts.map +1 -0
  176. package/dist/utils/testing.js +192 -0
  177. package/package.json +77 -0
@@ -0,0 +1,40 @@
1
+ import { ApplicationCommandDataResolvable } from "discord.js";
2
+ import type { PopiiClientConfig, PopiiCommandDefinition, PopiiClient } from "./types";
3
+ export declare function mapToDiscordCommands(commands: Map<string, PopiiCommandDefinition>): ApplicationCommandDataResolvable[];
4
+ /**
5
+ * Creates and returns a new Popii client instance.
6
+ *
7
+ * Call `client.start()` after configuring it to connect to Discord and begin
8
+ * loading commands, events, snaps, middlewares, and tasks from their directories.
9
+ *
10
+ * @category Core API
11
+ *
12
+ * @example Minimal bot
13
+ * ```ts
14
+ * import { popiiClient } from "popii";
15
+ *
16
+ * const client = popiiClient({ token: process.env.DISCORD_TOKEN! });
17
+ * client.start();
18
+ * ```
19
+ *
20
+ * @example With plugins and typed state
21
+ * ```ts
22
+ * import { popiiClient, sqlitePlugin, webPlugin, errorHandlerPlugin } from "popii";
23
+ *
24
+ * const client = popiiClient({
25
+ * token: process.env.DISCORD_TOKEN!,
26
+ * devGuildId: process.env.DEV_GUILD_ID,
27
+ * owners: [process.env.OWNER_ID!],
28
+ * state: { totalCommands: 0 },
29
+ * plugins: [
30
+ * sqlitePlugin(),
31
+ * webPlugin({ port: 3000, dashboard: true }),
32
+ * errorHandlerPlugin(),
33
+ * ]
34
+ * });
35
+ *
36
+ * client.start();
37
+ * ```
38
+ */
39
+ export declare function popiiClient<TState = any>(config: PopiiClientConfig<TState>): PopiiClient<TState>;
40
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmH,gCAAgC,EAAuB,MAAM,YAAY,CAAC;AASpM,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAA4B,WAAW,EAAoC,MAAM,SAAS,CAAC;AAMlJ,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,GAAG,gCAAgC,EAAE,CAiCtH;AAgED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,WAAW,CAAC,MAAM,GAAG,GAAG,EAAE,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAu3BhG"}
@@ -0,0 +1,47 @@
1
+ import type { PopiiCommandDefinition } from "../types";
2
+ /**
3
+ * Defines a slash command, text command, or context menu action.
4
+ *
5
+ * Drop the file anywhere under `src/commands/` and Popii registers it automatically.
6
+ * Nested folders become subcommand groups: `src/commands/config/set.ts` → `/config set`.
7
+ *
8
+ * @category Core API
9
+ *
10
+ * @example Basic slash command
11
+ * ```ts
12
+ * // src/commands/ping.ts
13
+ * import { command } from "popii";
14
+ *
15
+ * export default command({
16
+ * name: "ping",
17
+ * description: "Replies with Pong!",
18
+ * async do(pop) {
19
+ * await pop.reply(`Pong! ${pop.client.discord.ws.ping}ms`);
20
+ * }
21
+ * });
22
+ * ```
23
+ *
24
+ * @example Command with options and a cooldown
25
+ * ```ts
26
+ * import { command } from "popii";
27
+ * import { ApplicationCommandOptionType } from "discord.js";
28
+ *
29
+ * export default command({
30
+ * name: "greet",
31
+ * description: "Greet a user",
32
+ * cooldown: { ms: 5000, scope: "user" },
33
+ * options: [{
34
+ * name: "user",
35
+ * description: "Who to greet",
36
+ * type: ApplicationCommandOptionType.User,
37
+ * required: true,
38
+ * }],
39
+ * async do(pop) {
40
+ * const target = pop.options.getUser("user")!;
41
+ * await pop.reply(`Hello, ${target}!`);
42
+ * }
43
+ * });
44
+ * ```
45
+ */
46
+ export declare function command<const T extends PopiiCommandDefinition>(definition: T): T;
47
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/define/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,OAAO,CAAC,KAAK,CAAC,CAAC,SAAS,sBAAsB,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC,CAEhF"}
@@ -0,0 +1,52 @@
1
+ import type { ClientEvents } from "discord.js";
2
+ import type { PopiiEventFunction } from "../types";
3
+ /**
4
+ * Wraps a Discord.js event handler with the Popii `EventPop` context.
5
+ *
6
+ * Name the file after the Discord.js event you want to handle (e.g. `guildMemberAdd.ts`)
7
+ * and drop it in `src/events/`. Popii loads it automatically and infers the required
8
+ * Gateway intents from the filename — no manual intent configuration needed.
9
+ *
10
+ * The first argument is always `EventPop` (the Popii context object). The remaining
11
+ * arguments match the Discord.js event signature exactly.
12
+ *
13
+ * @category Core API
14
+ *
15
+ * @example Welcome message on member join
16
+ * ```ts
17
+ * // src/events/guildMemberAdd.ts
18
+ * import { event } from "popii";
19
+ *
20
+ * export default event(async (pop, member) => {
21
+ * const channel = member.guild.systemChannel;
22
+ * await channel?.send(`Welcome to the server, ${member}! 👋`);
23
+ * });
24
+ * ```
25
+ *
26
+ * @example Log when the bot joins a new guild
27
+ * ```ts
28
+ * // src/events/guildCreate.ts
29
+ * import { event } from "popii";
30
+ *
31
+ * export default event(async (pop, guild) => {
32
+ * pop.log.info(`Joined "${guild.name}" (${guild.memberCount} members)`);
33
+ * });
34
+ * ```
35
+ *
36
+ * @example React to messages (messageCreate)
37
+ * ```ts
38
+ * // src/events/messageCreate.ts
39
+ * import { event } from "popii";
40
+ *
41
+ * export default event(async (pop, message) => {
42
+ * if (message.author.bot) return;
43
+ * if (message.content.toLowerCase() === "hello") {
44
+ * await message.reply("Hello there!");
45
+ * }
46
+ * });
47
+ * ```
48
+ *
49
+ * @param handler The asynchronous function to run when the event fires.
50
+ */
51
+ export declare function event<K extends keyof ClientEvents>(handler: PopiiEventFunction<K>): PopiiEventFunction<K>;
52
+ //# sourceMappingURL=event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/define/event.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,YAAY,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAEzG"}
@@ -0,0 +1,55 @@
1
+ import type { PopiiComponentDefinition } from "../types";
2
+ /**
3
+ * Defines a persistent handler for Buttons, Select Menus, and Modals.
4
+ *
5
+ * Snaps match incoming interactions by `customId` (exact string or `RegExp`).
6
+ * Unlike one-shot collectors, Snaps survive bot restarts because they are
7
+ * registered by pattern at startup, not per-message.
8
+ *
9
+ * Drop the file in `src/snaps/` and Popii registers it automatically.
10
+ *
11
+ * @category Core API
12
+ *
13
+ * @example Button handler with exact customId
14
+ * ```ts
15
+ * // src/snaps/confirm.ts
16
+ * import { snap } from "popii";
17
+ *
18
+ * export default snap({
19
+ * customId: "confirm",
20
+ * async do(pop) {
21
+ * await pop.reply({ content: "Confirmed!", ephemeral: true });
22
+ * }
23
+ * });
24
+ * ```
25
+ *
26
+ * @example Dynamic customId with regex — extract data from the ID
27
+ * ```ts
28
+ * // src/snaps/delete.ts
29
+ * import { snap } from "popii";
30
+ *
31
+ * export default snap({
32
+ * customId: /^delete:(\d+)$/,
33
+ * async do(pop) {
34
+ * const messageId = pop.snapMatches?.[1];
35
+ * await pop.reply({ content: `Deleted message ${messageId}`, ephemeral: true });
36
+ * }
37
+ * });
38
+ * ```
39
+ *
40
+ * @example Prefix matching with structured data via pop.pack()
41
+ * ```ts
42
+ * // src/snaps/vote.ts
43
+ * import { snap } from "popii";
44
+ *
45
+ * export default snap({
46
+ * prefix: "vote",
47
+ * async do(pop) {
48
+ * const { pollId, choice } = pop.snapData; // decoded from pack()
49
+ * await pop.reply({ content: `Voted ${choice} on poll ${pollId}`, ephemeral: true });
50
+ * }
51
+ * });
52
+ * ```
53
+ */
54
+ export declare function snap<const T extends PopiiComponentDefinition>(definition: T): T;
55
+ //# sourceMappingURL=snap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snap.d.ts","sourceRoot":"","sources":["../../src/define/snap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,wBAAwB,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC,CAE/E"}
@@ -0,0 +1,64 @@
1
+ import type { PopiiTaskDefinition } from "../types";
2
+ /**
3
+ * Defines a scheduled background task using Bun's cron scheduler.
4
+ *
5
+ * Drop the file in `src/tasks/` and Popii registers it automatically.
6
+ * Tasks run on the specified cron schedule without blocking the event loop.
7
+ * They receive the full `PopiiClient` and, if triggered via `pop.schedule()`,
8
+ * an optional `payload` object.
9
+ *
10
+ * @category Core API
11
+ *
12
+ * @example Daily cleanup task
13
+ * ```ts
14
+ * // src/tasks/daily-cleanup.ts
15
+ * import { task } from "popii";
16
+ *
17
+ * export default task({
18
+ * name: "daily-cleanup",
19
+ * schedule: "0 3 * * *", // every day at 03:00 UTC
20
+ * async run(client) {
21
+ * const db = (client as any).db;
22
+ * db.exec("DELETE FROM expired_sessions WHERE expires_at < ?", Date.now());
23
+ * client.discord.emit("debug", "Cleaned up expired sessions");
24
+ * }
25
+ * });
26
+ * ```
27
+ *
28
+ * @example Task triggered on demand via pop.schedule()
29
+ * ```ts
30
+ * // src/tasks/send-report.ts
31
+ * import { task } from "popii";
32
+ *
33
+ * export default task({
34
+ * name: "send-report",
35
+ * async run(client, payload) {
36
+ * const { channelId, text } = payload as { channelId: string; text: string };
37
+ * const channel = client.discord.channels.cache.get(channelId);
38
+ * if (channel?.isTextBased()) await channel.send(text);
39
+ * }
40
+ * });
41
+ *
42
+ * // Trigger from a command:
43
+ * // await pop.schedule("send-report", { channelId: "123", text: "Report ready!" });
44
+ * ```
45
+ *
46
+ * @example With retry logic and timeout
47
+ * ```ts
48
+ * import { task } from "popii";
49
+ *
50
+ * export default task({
51
+ * name: "fetch-stats",
52
+ * schedule: "* * * * *", // every minute
53
+ * retries: 3,
54
+ * retryDelay: 2000,
55
+ * timeoutMs: 10_000,
56
+ * async run(client) {
57
+ * const stats = await fetchExternalStats();
58
+ * // store stats...
59
+ * }
60
+ * });
61
+ * ```
62
+ */
63
+ export declare function task<const T extends PopiiTaskDefinition>(definition: T): T;
64
+ //# sourceMappingURL=task.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../src/define/task.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,wBAAgB,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,mBAAmB,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC,CAE1E"}
@@ -0,0 +1,6 @@
1
+ export declare const CACHE_MAX_SIZE = 10000;
2
+ export declare function evictOldestCacheEntries(store: Map<string, {
3
+ expires: number;
4
+ value: any;
5
+ }>, count?: number): void;
6
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/handler/cache.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,QAAS,CAAC;AAErC,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,GAAG,CAAA;CAAE,CAAC,EAAE,KAAK,SAAM,QAevG"}
@@ -0,0 +1,3 @@
1
+ import type { EventPop, PopiiClient } from "../types";
2
+ export declare function createEventPop(client: PopiiClient, name: string, locale: string, eventArgs?: any[], prePluginOverrides?: Record<string, any>): EventPop;
3
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/handler/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAO,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI3D,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAE,GAAG,EAAO,EAAE,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,QAAQ,CA+K3J"}
@@ -0,0 +1,8 @@
1
+ export { buildMiddlewares, executeWithMiddlewares, DEFAULT_DEFER_MS } from "./middleware";
2
+ export { createEventPop } from "./context";
3
+ export { handleMessage } from "./message";
4
+ export { handleInteraction } from "./interaction";
5
+ export { closeLogWriter, popiiLogger } from "./logger";
6
+ export { withInteractionLock } from "./lock";
7
+ export { evictOldestCacheEntries, CACHE_MAX_SIZE } from "./cache";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/handler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type Interaction } from "discord.js";
2
+ import type { PopiiCommandDefinition, PopiiClientConfig, PopiiClient } from "../types";
3
+ export declare function handleInteraction(interaction: Interaction, commands: Map<string, PopiiCommandDefinition>, config: PopiiClientConfig, client: PopiiClient): Promise<void>;
4
+ //# sourceMappingURL=interaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../src/handler/interaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAO,sBAAsB,EAAE,iBAAiB,EAAE,WAAW,EAAgB,MAAM,UAAU,CAAC;AAM1G,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,EAC7C,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,WAAW,iBAuXpB"}
@@ -0,0 +1,2 @@
1
+ export declare function withInteractionLock<T>(interactionId: string, fn: () => Promise<T>): Promise<T>;
2
+ //# sourceMappingURL=lock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../src/handler/lock.ts"],"names":[],"mappings":"AAIA,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAW9F"}
@@ -0,0 +1,4 @@
1
+ import type { PopLogger, PopiiClient } from "../types";
2
+ export declare function closeLogWriter(): Promise<void>;
3
+ export declare function popiiLogger(commandName: string, customLogger?: PopLogger, fileLogging?: boolean, client?: PopiiClient): PopLogger;
4
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/handler/logger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAKvD,wBAAgB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAU9C;AAcD,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAkCjI"}
@@ -0,0 +1,4 @@
1
+ import { type Message } from "discord.js";
2
+ import type { PopiiCommandDefinition, PopiiClientConfig, PopiiClient } from "../types";
3
+ export declare function handleMessage(message: Message, commands: Map<string, PopiiCommandDefinition>, config: PopiiClientConfig, client: PopiiClient): Promise<void>;
4
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/handler/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,KAAK,EAAO,sBAAsB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AA8C5F,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,EAC7C,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,WAAW,iBAyQpB"}
@@ -0,0 +1,5 @@
1
+ import type { Pop, PopiiCommandDefinition, PopiiComponentDefinition, PopiiClientConfig, PopiiClient, PopiiMiddleware } from "../types";
2
+ export declare const DEFAULT_DEFER_MS = 2000;
3
+ export declare function buildMiddlewares(item: PopiiCommandDefinition | PopiiComponentDefinition, config: PopiiClientConfig, client: PopiiClient, fullCommandName?: string): PopiiMiddleware[];
4
+ export declare function executeWithMiddlewares(pop: Pop, middlewares: PopiiMiddleware[], targetDo: (pop: Pop) => Promise<void> | void, activeCommand?: PopiiCommandDefinition | PopiiComponentDefinition): Promise<void>;
5
+ //# sourceMappingURL=middleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/handler/middleware.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAe,MAAM,UAAU,CAAC;AAGpJ,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAErC,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,wBAAwB,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,eAAe,EAAE,CA+MrL;AAED,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,eAAe,EAAE,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,aAAa,CAAC,EAAE,sBAAsB,GAAG,wBAAwB,iBAsErM"}
@@ -0,0 +1,31 @@
1
+ export { popiiClient } from "./client";
2
+ export { command } from "./define/command";
3
+ export { snap } from "./define/snap";
4
+ export { event } from "./define/event";
5
+ export { middleware } from "./loader/middleware";
6
+ export { task } from "./define/task";
7
+ export { PopiiError, PopiiSilentError } from "./utils/error";
8
+ export type * from "./types";
9
+ export { reloadPlugin } from "./plugins/reload";
10
+ export { commandLoggerPlugin, type CommandLoggerOptions } from "./plugins/commandLogger";
11
+ export { permissionGuardPlugin } from "./plugins/permissionGuard";
12
+ export { commandAnalyticPlugin } from "./plugins/commandAnalytic";
13
+ export { errorHandlerPlugin } from "./plugins/errorHandler";
14
+ export { uiPlugin, type UIPluginOptions, type FormField } from "./plugins/ui";
15
+ export { sqlitePlugin, type SQLitePluginOptions } from "./plugins/sqlite";
16
+ export { webPlugin, type WebPluginOptions } from "./plugins/web";
17
+ export { telemetryPlugin, type TelemetryPluginOptions } from "./plugins/telemetry";
18
+ export { voicePlugin, type VoicePluginOptions } from "./plugins/voice";
19
+ export { mongoosePlugin, type MongoosePluginOptions } from "./plugins/mongoose";
20
+ export { PopiiShardingManager, type PopiiShardingOptions } from "./utils/sharding";
21
+ export { deskPlugin, type PopiiDeskOptions } from "./plugins/desk";
22
+ export { popiiAiPlugin, type PopiiAiOptions } from "./plugins/ai";
23
+ export { payPlugin, type PopiiPayOptions } from "./plugins/pay";
24
+ export { autoModPlugin, type AutoModOptions } from "./plugins/automod";
25
+ export { economyPlugin, type EconomyPluginOptions } from "./plugins/economy";
26
+ export { giveawayPlugin, type GiveawayPluginOptions } from "./plugins/giveaway";
27
+ export { activityRotatorPlugin, type ActivityRotatorOptions } from "./plugins/activity";
28
+ export { captchaPlugin, type CaptchaPluginOptions } from "./plugins/captcha";
29
+ export { canvasPlugin, CanvasBuilder, type NowPlayingTrack, type NowPlayingCardOptions } from "./plugins/canvas";
30
+ export { lastFmPlugin, type PopiiLastFmOptions } from "./plugins/lastfm";
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC7D,mBAAmB,SAAS,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,KAAK,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACjH,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}