@fluxerjs/core 1.0.8 → 1.1.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 (37) hide show
  1. package/dist/{Channel-TWPDKW2P.mjs → Channel-WJZZSNML.mjs} +3 -1
  2. package/dist/{ClientUser-2K2BACK7.mjs → ClientUser-DJO2FS7P.mjs} +1 -1
  3. package/dist/Guild-2P77HBQM.mjs +11 -0
  4. package/dist/GuildBan-7CXLTPKY.mjs +7 -0
  5. package/dist/GuildMember-43B5E5CH.mjs +9 -0
  6. package/dist/{Message-G2QIKZQK.mjs → Invite-UM5BU5A6.mjs} +3 -3
  7. package/dist/Message-OFIVTTAZ.mjs +9 -0
  8. package/dist/{MessageReaction-XRPYZDSC.mjs → MessageReaction-V4UZ7OXE.mjs} +1 -1
  9. package/dist/{Role-SVLWIAMN.mjs → Role-5MWSGL66.mjs} +1 -1
  10. package/dist/Webhook-RWDDYW2Q.mjs +10 -0
  11. package/dist/chunk-4XJIM6SC.mjs +315 -0
  12. package/dist/chunk-AH7KYH2Z.mjs +50 -0
  13. package/dist/{chunk-HBF5QEDH.mjs → chunk-CEABHTAF.mjs} +1 -0
  14. package/dist/chunk-CJVQNARM.mjs +145 -0
  15. package/dist/chunk-DQ4TNBPG.mjs +63 -0
  16. package/dist/chunk-DUQAD7F6.mjs +173 -0
  17. package/dist/{chunk-4GCZFOS5.mjs → chunk-JHNKZIHY.mjs} +54 -3
  18. package/dist/chunk-LU2SNC5G.mjs +392 -0
  19. package/dist/chunk-PM2IUGNR.mjs +29 -0
  20. package/dist/chunk-QEXIYXXU.mjs +62 -0
  21. package/dist/chunk-UXIF75BV.mjs +36 -0
  22. package/dist/chunk-V7LPVPGH.mjs +305 -0
  23. package/dist/chunk-X6K3ZD62.mjs +53 -0
  24. package/dist/index.d.mts +802 -160
  25. package/dist/index.d.ts +802 -160
  26. package/dist/index.js +1467 -262
  27. package/dist/index.mjs +292 -119
  28. package/package.json +7 -7
  29. package/dist/Guild-CMZGA6DW.mjs +0 -10
  30. package/dist/GuildMember-DW2N6ITI.mjs +0 -7
  31. package/dist/Webhook-2MQESB7Z.mjs +0 -7
  32. package/dist/chunk-CO5EL5LH.mjs +0 -168
  33. package/dist/chunk-CZIO2D7F.mjs +0 -207
  34. package/dist/chunk-JVEOQFUX.mjs +0 -52
  35. package/dist/chunk-SQVCCSNN.mjs +0 -41
  36. package/dist/chunk-TJVZEILY.mjs +0 -120
  37. package/dist/chunk-ZGMM6IPQ.mjs +0 -79
@@ -1,79 +0,0 @@
1
- import {
2
- Base
3
- } from "./chunk-XNS4O6QJ.mjs";
4
-
5
- // src/structures/Webhook.ts
6
- import { Routes } from "@fluxerjs/types";
7
- var Webhook = class _Webhook extends Base {
8
- client;
9
- id;
10
- guildId;
11
- channelId;
12
- name;
13
- avatar;
14
- /** Present only when webhook was created via createWebhook(); not returned when fetching. */
15
- token;
16
- /** @param data - API webhook from POST /channels/{id}/webhooks (has token) or GET /webhooks/{id} (no token) */
17
- constructor(client, data) {
18
- super();
19
- this.client = client;
20
- this.id = data.id;
21
- this.guildId = data.guild_id;
22
- this.channelId = data.channel_id;
23
- this.name = data.name ?? "Unknown";
24
- this.avatar = data.avatar ?? null;
25
- this.token = data.token ?? null;
26
- }
27
- /** Delete this webhook. Requires bot token with Manage Webhooks permission. */
28
- async delete() {
29
- await this.client.rest.delete(Routes.webhook(this.id), { auth: true });
30
- }
31
- /**
32
- * Send a message via this webhook. Requires the webhook token (only present when created, not when fetched).
33
- * @throws Error if token is not available
34
- */
35
- async send(options) {
36
- if (!this.token) {
37
- throw new Error(
38
- "Webhook token is required to send. The token is only returned when creating a webhook; fetched webhooks cannot send."
39
- );
40
- }
41
- const body = typeof options === "string" ? { content: options } : options;
42
- await this.client.rest.post(Routes.webhookExecute(this.id, this.token), {
43
- body,
44
- auth: false
45
- });
46
- }
47
- /**
48
- * Fetch a webhook by ID using bot auth.
49
- * @param client - The client instance
50
- * @param webhookId - The webhook ID
51
- * @returns Webhook without token (cannot send)
52
- */
53
- static async fetch(client, webhookId) {
54
- const data = await client.rest.get(Routes.webhook(webhookId));
55
- return new _Webhook(client, data);
56
- }
57
- /**
58
- * Create a Webhook instance from an ID and token (e.g. from a stored webhook URL).
59
- * @param client - The client instance
60
- * @param webhookId - The webhook ID
61
- * @param token - The webhook token (from createWebhook or stored)
62
- * @param options - Optional channelId, guildId, name for display
63
- */
64
- static fromToken(client, webhookId, token, options) {
65
- return new _Webhook(client, {
66
- id: webhookId,
67
- guild_id: options?.guildId ?? "",
68
- channel_id: options?.channelId ?? "",
69
- name: options?.name ?? "Webhook",
70
- avatar: null,
71
- token,
72
- user: { id: "", username: "webhook", discriminator: "0" }
73
- });
74
- }
75
- };
76
-
77
- export {
78
- Webhook
79
- };