@fluxerjs/core 1.0.6 → 1.0.8
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.
- package/dist/{Channel-2WNJ445K.mjs → Channel-TWPDKW2P.mjs} +3 -1
- package/dist/{ClientUser-J6HQVSDJ.mjs → ClientUser-2K2BACK7.mjs} +1 -2
- package/dist/{Guild-GOQZ7XP4.mjs → Guild-CMZGA6DW.mjs} +3 -1
- package/dist/GuildMember-DW2N6ITI.mjs +7 -0
- package/dist/{Webhook-NUQCJAWZ.mjs → Message-G2QIKZQK.mjs} +3 -3
- package/dist/MessageReaction-XRPYZDSC.mjs +7 -0
- package/dist/Role-SVLWIAMN.mjs +7 -0
- package/dist/{Webhook-2RHBXH7R.mjs → Webhook-2MQESB7Z.mjs} +1 -1
- package/dist/chunk-4GCZFOS5.mjs +86 -0
- package/dist/chunk-CO5EL5LH.mjs +168 -0
- package/dist/chunk-CZIO2D7F.mjs +207 -0
- package/dist/chunk-HBF5QEDH.mjs +42 -0
- package/dist/chunk-JVEOQFUX.mjs +52 -0
- package/dist/chunk-SQVCCSNN.mjs +41 -0
- package/dist/chunk-TJVZEILY.mjs +120 -0
- package/dist/{chunk-BUEXP5SZ.mjs → chunk-ZGMM6IPQ.mjs} +12 -3
- package/dist/index.d.mts +539 -73
- package/dist/index.d.ts +539 -73
- package/dist/index.js +1125 -355
- package/dist/index.mjs +520 -194
- package/package.json +27 -8
- package/dist/Channel-HM2UY4DN.mjs +0 -17
- package/dist/Channel-IKL3SJXN.mjs +0 -17
- package/dist/Channel-KILNV5V3.mjs +0 -17
- package/dist/Channel-TOAQGSRX.mjs +0 -17
- package/dist/Channel-VENHOL7S.mjs +0 -17
- package/dist/ClientUser-RNDKHQ3Z.mjs +0 -9
- package/dist/Guild-36EGAAEW.mjs +0 -8
- package/dist/Guild-CA3W6DOD.mjs +0 -8
- package/dist/Guild-NHNQ5TIA.mjs +0 -8
- package/dist/Guild-ZOFF5LFR.mjs +0 -8
- package/dist/GuildMember-RGVPVUAG.mjs +0 -9
- package/dist/GuildMember-XF7K2R45.mjs +0 -9
- package/dist/Message-23Z3RPCZ.mjs +0 -9
- package/dist/Message-33APPS76.mjs +0 -9
- package/dist/Message-PZUU7ZFR.mjs +0 -9
- package/dist/Message-XB5WNMHL.mjs +0 -9
- package/dist/chunk-3CNUPFDI.mjs +0 -59
- package/dist/chunk-4DBGMFOQ.mjs +0 -14
- package/dist/chunk-6CEMF2LO.mjs +0 -14
- package/dist/chunk-6EBNOON4.mjs +0 -86
- package/dist/chunk-72OY7B3D.mjs +0 -72
- package/dist/chunk-7FYM4D2E.mjs +0 -50
- package/dist/chunk-7GZN6JXT.mjs +0 -50
- package/dist/chunk-7H3TKJUT.mjs +0 -53
- package/dist/chunk-EF32ILJL.mjs +0 -102
- package/dist/chunk-F2EEQP5O.mjs +0 -86
- package/dist/chunk-GUNWHOQO.mjs +0 -42
- package/dist/chunk-L25ON7WB.mjs +0 -52
- package/dist/chunk-LBBIQOSH.mjs +0 -53
- package/dist/chunk-OHIHIQAS.mjs +0 -102
- package/dist/chunk-P4IRDGB4.mjs +0 -43
- package/dist/chunk-QDCFQF6J.mjs +0 -36
- package/dist/chunk-QDNFJVVE.mjs +0 -70
- package/dist/chunk-SW6KNICI.mjs +0 -52
- package/dist/chunk-TE5IC7IP.mjs +0 -36
- package/dist/chunk-WFONGZGK.mjs +0 -42
- package/dist/chunk-XXCBJJZE.mjs +0 -88
- package/dist/chunk-ZHRQQZ4X.mjs +0 -102
package/package.json
CHANGED
|
@@ -3,8 +3,23 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.8",
|
|
7
7
|
"description": "A fully-featured SDK for Fluxer bots",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/fluxerjs/core.git",
|
|
11
|
+
"directory": "packages/fluxer-core"
|
|
12
|
+
},
|
|
13
|
+
"bugs": "https://github.com/fluxerjs/core/issues",
|
|
14
|
+
"homepage": "https://fluxerjs.blstmo.com",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"fluxer",
|
|
17
|
+
"discord",
|
|
18
|
+
"sdk",
|
|
19
|
+
"bot",
|
|
20
|
+
"api"
|
|
21
|
+
],
|
|
22
|
+
"license": "AGPL-3.0",
|
|
8
23
|
"main": "./dist/index.js",
|
|
9
24
|
"module": "./dist/index.mjs",
|
|
10
25
|
"types": "./dist/index.d.ts",
|
|
@@ -19,12 +34,12 @@
|
|
|
19
34
|
"dist"
|
|
20
35
|
],
|
|
21
36
|
"dependencies": {
|
|
22
|
-
"@fluxerjs/rest": "1.0.
|
|
23
|
-
"@fluxerjs/ws": "1.0.
|
|
24
|
-
"@fluxerjs/collection": "1.0.
|
|
25
|
-
"@fluxerjs/
|
|
26
|
-
"@fluxerjs/
|
|
27
|
-
"@fluxerjs/
|
|
37
|
+
"@fluxerjs/rest": "1.0.8",
|
|
38
|
+
"@fluxerjs/ws": "1.0.8",
|
|
39
|
+
"@fluxerjs/collection": "1.0.8",
|
|
40
|
+
"@fluxerjs/util": "1.0.8",
|
|
41
|
+
"@fluxerjs/types": "1.0.8",
|
|
42
|
+
"@fluxerjs/builders": "1.0.8"
|
|
28
43
|
},
|
|
29
44
|
"devDependencies": {
|
|
30
45
|
"@types/node": "^20.0.0",
|
|
@@ -36,6 +51,10 @@
|
|
|
36
51
|
},
|
|
37
52
|
"scripts": {
|
|
38
53
|
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
39
|
-
"clean": "rm -rf dist"
|
|
54
|
+
"clean": "rm -rf dist",
|
|
55
|
+
"lint": "eslint src --max-warnings 0 --config ../../eslint.config.js",
|
|
56
|
+
"lint:fix": "eslint src --fix --config ../../eslint.config.js",
|
|
57
|
+
"test": "vitest run --passWithNoTests",
|
|
58
|
+
"test:coverage": "vitest run --coverage --passWithNoTests"
|
|
40
59
|
}
|
|
41
60
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CategoryChannel,
|
|
3
|
-
Channel,
|
|
4
|
-
GuildChannel,
|
|
5
|
-
LinkChannel,
|
|
6
|
-
TextChannel,
|
|
7
|
-
VoiceChannel
|
|
8
|
-
} from "./chunk-6EBNOON4.mjs";
|
|
9
|
-
import "./chunk-XNS4O6QJ.mjs";
|
|
10
|
-
export {
|
|
11
|
-
CategoryChannel,
|
|
12
|
-
Channel,
|
|
13
|
-
GuildChannel,
|
|
14
|
-
LinkChannel,
|
|
15
|
-
TextChannel,
|
|
16
|
-
VoiceChannel
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CategoryChannel,
|
|
3
|
-
Channel,
|
|
4
|
-
GuildChannel,
|
|
5
|
-
LinkChannel,
|
|
6
|
-
TextChannel,
|
|
7
|
-
VoiceChannel
|
|
8
|
-
} from "./chunk-OHIHIQAS.mjs";
|
|
9
|
-
import "./chunk-XNS4O6QJ.mjs";
|
|
10
|
-
export {
|
|
11
|
-
CategoryChannel,
|
|
12
|
-
Channel,
|
|
13
|
-
GuildChannel,
|
|
14
|
-
LinkChannel,
|
|
15
|
-
TextChannel,
|
|
16
|
-
VoiceChannel
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CategoryChannel,
|
|
3
|
-
Channel,
|
|
4
|
-
GuildChannel,
|
|
5
|
-
LinkChannel,
|
|
6
|
-
TextChannel,
|
|
7
|
-
VoiceChannel
|
|
8
|
-
} from "./chunk-XXCBJJZE.mjs";
|
|
9
|
-
import "./chunk-XNS4O6QJ.mjs";
|
|
10
|
-
export {
|
|
11
|
-
CategoryChannel,
|
|
12
|
-
Channel,
|
|
13
|
-
GuildChannel,
|
|
14
|
-
LinkChannel,
|
|
15
|
-
TextChannel,
|
|
16
|
-
VoiceChannel
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CategoryChannel,
|
|
3
|
-
Channel,
|
|
4
|
-
GuildChannel,
|
|
5
|
-
LinkChannel,
|
|
6
|
-
TextChannel,
|
|
7
|
-
VoiceChannel
|
|
8
|
-
} from "./chunk-F2EEQP5O.mjs";
|
|
9
|
-
import "./chunk-XNS4O6QJ.mjs";
|
|
10
|
-
export {
|
|
11
|
-
CategoryChannel,
|
|
12
|
-
Channel,
|
|
13
|
-
GuildChannel,
|
|
14
|
-
LinkChannel,
|
|
15
|
-
TextChannel,
|
|
16
|
-
VoiceChannel
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CategoryChannel,
|
|
3
|
-
Channel,
|
|
4
|
-
GuildChannel,
|
|
5
|
-
LinkChannel,
|
|
6
|
-
TextChannel,
|
|
7
|
-
VoiceChannel
|
|
8
|
-
} from "./chunk-EF32ILJL.mjs";
|
|
9
|
-
import "./chunk-XNS4O6QJ.mjs";
|
|
10
|
-
export {
|
|
11
|
-
CategoryChannel,
|
|
12
|
-
Channel,
|
|
13
|
-
GuildChannel,
|
|
14
|
-
LinkChannel,
|
|
15
|
-
TextChannel,
|
|
16
|
-
VoiceChannel
|
|
17
|
-
};
|
package/dist/Guild-36EGAAEW.mjs
DELETED
package/dist/Guild-CA3W6DOD.mjs
DELETED
package/dist/Guild-NHNQ5TIA.mjs
DELETED
package/dist/Guild-ZOFF5LFR.mjs
DELETED
package/dist/chunk-3CNUPFDI.mjs
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
User
|
|
3
|
-
} from "./chunk-P4IRDGB4.mjs";
|
|
4
|
-
import {
|
|
5
|
-
Base
|
|
6
|
-
} from "./chunk-XNS4O6QJ.mjs";
|
|
7
|
-
|
|
8
|
-
// src/structures/Message.ts
|
|
9
|
-
import { Collection } from "@fluxerjs/collection";
|
|
10
|
-
import { Routes } from "@fluxerjs/types";
|
|
11
|
-
import { EmbedBuilder } from "@fluxerjs/builders";
|
|
12
|
-
var Message = class _Message extends Base {
|
|
13
|
-
client;
|
|
14
|
-
id;
|
|
15
|
-
channelId;
|
|
16
|
-
guildId;
|
|
17
|
-
author;
|
|
18
|
-
content;
|
|
19
|
-
createdAt;
|
|
20
|
-
editedAt;
|
|
21
|
-
pinned;
|
|
22
|
-
attachments;
|
|
23
|
-
channel;
|
|
24
|
-
constructor(client, data) {
|
|
25
|
-
super();
|
|
26
|
-
this.client = client;
|
|
27
|
-
this.id = data.id;
|
|
28
|
-
this.channelId = data.channel_id;
|
|
29
|
-
this.guildId = data.guild_id ?? null;
|
|
30
|
-
this.author = new User(client, data.author);
|
|
31
|
-
this.content = data.content;
|
|
32
|
-
this.createdAt = new Date(data.timestamp);
|
|
33
|
-
this.editedAt = data.edited_timestamp ? new Date(data.edited_timestamp) : null;
|
|
34
|
-
this.pinned = data.pinned;
|
|
35
|
-
this.attachments = new Collection();
|
|
36
|
-
for (const a of data.attachments ?? []) this.attachments.set(a.id, a);
|
|
37
|
-
}
|
|
38
|
-
async reply(options) {
|
|
39
|
-
const body = typeof options === "string" ? { content: options, message_reference: { channel_id: this.channelId, message_id: this.id, guild_id: this.guildId ?? void 0 } } : { ...options, message_reference: { channel_id: this.channelId, message_id: this.id, guild_id: this.guildId ?? void 0 } };
|
|
40
|
-
const data = await this.client.rest.post(Routes.channelMessages(this.channelId), { body });
|
|
41
|
-
return new _Message(this.client, data);
|
|
42
|
-
}
|
|
43
|
-
async edit(options) {
|
|
44
|
-
const body = {};
|
|
45
|
-
if (options.content !== void 0) body.content = options.content;
|
|
46
|
-
if (options.embeds?.length) {
|
|
47
|
-
body.embeds = options.embeds.map((e) => e instanceof EmbedBuilder ? e.toJSON() : e);
|
|
48
|
-
}
|
|
49
|
-
const data = await this.client.rest.patch(Routes.channelMessage(this.channelId, this.id), { body });
|
|
50
|
-
return new _Message(this.client, data);
|
|
51
|
-
}
|
|
52
|
-
async delete() {
|
|
53
|
-
await this.client.rest.delete(Routes.channelMessage(this.channelId, this.id));
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export {
|
|
58
|
-
Message
|
|
59
|
-
};
|
package/dist/chunk-4DBGMFOQ.mjs
DELETED
package/dist/chunk-6CEMF2LO.mjs
DELETED
package/dist/chunk-6EBNOON4.mjs
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Base
|
|
3
|
-
} from "./chunk-XNS4O6QJ.mjs";
|
|
4
|
-
|
|
5
|
-
// src/structures/Channel.ts
|
|
6
|
-
import { ChannelType, Routes } from "@fluxer/types";
|
|
7
|
-
var Channel = class extends Base {
|
|
8
|
-
client;
|
|
9
|
-
id;
|
|
10
|
-
type;
|
|
11
|
-
constructor(client, data) {
|
|
12
|
-
super();
|
|
13
|
-
this.client = client;
|
|
14
|
-
this.id = data.id;
|
|
15
|
-
this.type = data.type;
|
|
16
|
-
}
|
|
17
|
-
static from(client, data) {
|
|
18
|
-
const type = data.type ?? 0;
|
|
19
|
-
if (type === ChannelType.GuildText) return new TextChannel(client, data);
|
|
20
|
-
if (type === ChannelType.GuildCategory) return new CategoryChannel(client, data);
|
|
21
|
-
if (type === ChannelType.GuildVoice) return new VoiceChannel(client, data);
|
|
22
|
-
if (type === ChannelType.GuildLink) return new LinkChannel(client, data);
|
|
23
|
-
return new GuildChannel(client, data);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
var GuildChannel = class extends Channel {
|
|
27
|
-
guildId;
|
|
28
|
-
name;
|
|
29
|
-
position;
|
|
30
|
-
parentId;
|
|
31
|
-
constructor(client, data) {
|
|
32
|
-
super(client, data);
|
|
33
|
-
this.guildId = data.guild_id ?? "";
|
|
34
|
-
this.name = data.name ?? null;
|
|
35
|
-
this.position = data.position;
|
|
36
|
-
this.parentId = data.parent_id ?? null;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
var TextChannel = class extends GuildChannel {
|
|
40
|
-
topic;
|
|
41
|
-
nsfw;
|
|
42
|
-
rateLimitPerUser;
|
|
43
|
-
lastMessageId;
|
|
44
|
-
constructor(client, data) {
|
|
45
|
-
super(client, data);
|
|
46
|
-
this.topic = data.topic ?? null;
|
|
47
|
-
this.nsfw = data.nsfw ?? false;
|
|
48
|
-
this.rateLimitPerUser = data.rate_limit_per_user ?? 0;
|
|
49
|
-
this.lastMessageId = data.last_message_id ?? null;
|
|
50
|
-
}
|
|
51
|
-
async send(options) {
|
|
52
|
-
const body = typeof options === "string" ? { content: options } : options;
|
|
53
|
-
const { Message } = await import("./Message-XB5WNMHL.mjs");
|
|
54
|
-
const data = await this.client.rest.post(Routes.channelMessages(this.id), { body });
|
|
55
|
-
return new Message(this.client, data);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
var CategoryChannel = class extends GuildChannel {
|
|
59
|
-
};
|
|
60
|
-
var VoiceChannel = class extends GuildChannel {
|
|
61
|
-
bitrate;
|
|
62
|
-
userLimit;
|
|
63
|
-
rtcRegion;
|
|
64
|
-
constructor(client, data) {
|
|
65
|
-
super(client, data);
|
|
66
|
-
this.bitrate = data.bitrate ?? null;
|
|
67
|
-
this.userLimit = data.user_limit ?? null;
|
|
68
|
-
this.rtcRegion = data.rtc_region ?? null;
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
var LinkChannel = class extends GuildChannel {
|
|
72
|
-
url;
|
|
73
|
-
constructor(client, data) {
|
|
74
|
-
super(client, data);
|
|
75
|
-
this.url = data.url ?? null;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export {
|
|
80
|
-
Channel,
|
|
81
|
-
GuildChannel,
|
|
82
|
-
TextChannel,
|
|
83
|
-
CategoryChannel,
|
|
84
|
-
VoiceChannel,
|
|
85
|
-
LinkChannel
|
|
86
|
-
};
|
package/dist/chunk-72OY7B3D.mjs
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
User
|
|
3
|
-
} from "./chunk-SW6KNICI.mjs";
|
|
4
|
-
import {
|
|
5
|
-
Base
|
|
6
|
-
} from "./chunk-XNS4O6QJ.mjs";
|
|
7
|
-
|
|
8
|
-
// src/structures/Message.ts
|
|
9
|
-
import { Collection } from "@fluxerjs/collection";
|
|
10
|
-
import { Routes } from "@fluxerjs/types";
|
|
11
|
-
var Message = class _Message extends Base {
|
|
12
|
-
/** The client that received this message. */
|
|
13
|
-
client;
|
|
14
|
-
/** Snowflake ID of the message. */
|
|
15
|
-
id;
|
|
16
|
-
/** Channel ID. */
|
|
17
|
-
channelId;
|
|
18
|
-
/** Guild ID, or null for DMs. */
|
|
19
|
-
guildId;
|
|
20
|
-
/** User who sent the message. */
|
|
21
|
-
author;
|
|
22
|
-
/** Text content. */
|
|
23
|
-
content;
|
|
24
|
-
/** When the message was created. */
|
|
25
|
-
createdAt;
|
|
26
|
-
/** When the message was last edited, or null. */
|
|
27
|
-
editedAt;
|
|
28
|
-
/** Whether the message is pinned. */
|
|
29
|
-
pinned;
|
|
30
|
-
/** Attachments. */
|
|
31
|
-
attachments;
|
|
32
|
-
/** Resolved channel, when available. */
|
|
33
|
-
channel;
|
|
34
|
-
/** @internal */
|
|
35
|
-
constructor(client, data) {
|
|
36
|
-
super();
|
|
37
|
-
this.client = client;
|
|
38
|
-
this.id = data.id;
|
|
39
|
-
this.channelId = data.channel_id;
|
|
40
|
-
this.guildId = data.guild_id ?? null;
|
|
41
|
-
this.author = new User(client, data.author);
|
|
42
|
-
this.content = data.content;
|
|
43
|
-
this.createdAt = new Date(data.timestamp);
|
|
44
|
-
this.editedAt = data.edited_timestamp ? new Date(data.edited_timestamp) : null;
|
|
45
|
-
this.pinned = data.pinned;
|
|
46
|
-
this.attachments = new Collection();
|
|
47
|
-
for (const a of data.attachments ?? []) this.attachments.set(a.id, a);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Reply to this message (creates a reply reference).
|
|
51
|
-
* @param options - Content string or object with content/embeds
|
|
52
|
-
* @returns The new Message
|
|
53
|
-
*/
|
|
54
|
-
async reply(options) {
|
|
55
|
-
const body = typeof options === "string" ? { content: options, message_reference: { channel_id: this.channelId, message_id: this.id, guild_id: this.guildId ?? void 0 } } : { ...options, message_reference: { channel_id: this.channelId, message_id: this.id, guild_id: this.guildId ?? void 0 } };
|
|
56
|
-
const data = await this.client.rest.post(Routes.channelMessages(this.channelId), { body });
|
|
57
|
-
return new _Message(this.client, data);
|
|
58
|
-
}
|
|
59
|
-
/** Edit this message. */
|
|
60
|
-
async edit(options) {
|
|
61
|
-
const data = await this.client.rest.patch(Routes.channelMessage(this.channelId, this.id), { body: options });
|
|
62
|
-
return new _Message(this.client, data);
|
|
63
|
-
}
|
|
64
|
-
/** Delete this message. */
|
|
65
|
-
async delete() {
|
|
66
|
-
await this.client.rest.delete(Routes.channelMessage(this.channelId, this.id));
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export {
|
|
71
|
-
Message
|
|
72
|
-
};
|
package/dist/chunk-7FYM4D2E.mjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CDN_URL
|
|
3
|
-
} from "./chunk-HQMYRYMY.mjs";
|
|
4
|
-
import {
|
|
5
|
-
Base
|
|
6
|
-
} from "./chunk-XNS4O6QJ.mjs";
|
|
7
|
-
|
|
8
|
-
// src/structures/Guild.ts
|
|
9
|
-
import { Collection } from "@fluxerjs/collection";
|
|
10
|
-
import { Routes } from "@fluxerjs/types";
|
|
11
|
-
var Guild = class extends Base {
|
|
12
|
-
client;
|
|
13
|
-
id;
|
|
14
|
-
name;
|
|
15
|
-
icon;
|
|
16
|
-
banner;
|
|
17
|
-
ownerId;
|
|
18
|
-
members = new Collection();
|
|
19
|
-
channels = new Collection();
|
|
20
|
-
constructor(client, data) {
|
|
21
|
-
super();
|
|
22
|
-
this.client = client;
|
|
23
|
-
this.id = data.id;
|
|
24
|
-
this.name = data.name;
|
|
25
|
-
this.icon = data.icon ?? null;
|
|
26
|
-
this.banner = data.banner ?? null;
|
|
27
|
-
this.ownerId = data.owner_id;
|
|
28
|
-
}
|
|
29
|
-
iconURL(options) {
|
|
30
|
-
if (!this.icon) return null;
|
|
31
|
-
const size = options?.size ? `?size=${options.size}` : "";
|
|
32
|
-
return `${CDN_URL}/icons/${this.id}/${this.icon}.png${size}`;
|
|
33
|
-
}
|
|
34
|
-
bannerURL(options) {
|
|
35
|
-
if (!this.banner) return null;
|
|
36
|
-
const size = options?.size ? `?size=${options.size}` : "";
|
|
37
|
-
return `${CDN_URL}/banners/${this.id}/${this.banner}.png${size}`;
|
|
38
|
-
}
|
|
39
|
-
/** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
|
|
40
|
-
async fetchWebhooks() {
|
|
41
|
-
const { Webhook } = await import("./Webhook-NUQCJAWZ.mjs");
|
|
42
|
-
const data = await this.client.rest.get(Routes.guildWebhooks(this.id));
|
|
43
|
-
const list = Array.isArray(data) ? data : Object.values(data ?? {});
|
|
44
|
-
return list.map((w) => new Webhook(this.client, w));
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export {
|
|
49
|
-
Guild
|
|
50
|
-
};
|
package/dist/chunk-7GZN6JXT.mjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CDN_URL
|
|
3
|
-
} from "./chunk-HQMYRYMY.mjs";
|
|
4
|
-
import {
|
|
5
|
-
Base
|
|
6
|
-
} from "./chunk-XNS4O6QJ.mjs";
|
|
7
|
-
|
|
8
|
-
// src/structures/Guild.ts
|
|
9
|
-
import { Collection } from "@fluxerjs/collection";
|
|
10
|
-
import { Routes } from "@fluxerjs/types";
|
|
11
|
-
var Guild = class extends Base {
|
|
12
|
-
client;
|
|
13
|
-
id;
|
|
14
|
-
name;
|
|
15
|
-
icon;
|
|
16
|
-
banner;
|
|
17
|
-
ownerId;
|
|
18
|
-
members = new Collection();
|
|
19
|
-
channels = new Collection();
|
|
20
|
-
constructor(client, data) {
|
|
21
|
-
super();
|
|
22
|
-
this.client = client;
|
|
23
|
-
this.id = data.id;
|
|
24
|
-
this.name = data.name;
|
|
25
|
-
this.icon = data.icon ?? null;
|
|
26
|
-
this.banner = data.banner ?? null;
|
|
27
|
-
this.ownerId = data.owner_id;
|
|
28
|
-
}
|
|
29
|
-
iconURL(options) {
|
|
30
|
-
if (!this.icon) return null;
|
|
31
|
-
const size = options?.size ? `?size=${options.size}` : "";
|
|
32
|
-
return `${CDN_URL}/icons/${this.id}/${this.icon}.png${size}`;
|
|
33
|
-
}
|
|
34
|
-
bannerURL(options) {
|
|
35
|
-
if (!this.banner) return null;
|
|
36
|
-
const size = options?.size ? `?size=${options.size}` : "";
|
|
37
|
-
return `${CDN_URL}/banners/${this.id}/${this.banner}.png${size}`;
|
|
38
|
-
}
|
|
39
|
-
/** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
|
|
40
|
-
async fetchWebhooks() {
|
|
41
|
-
const { Webhook } = await import("./Webhook-2RHBXH7R.mjs");
|
|
42
|
-
const data = await this.client.rest.get(Routes.guildWebhooks(this.id));
|
|
43
|
-
const list = Array.isArray(data) ? data : Object.values(data ?? {});
|
|
44
|
-
return list.map((w) => new Webhook(this.client, w));
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export {
|
|
49
|
-
Guild
|
|
50
|
-
};
|
package/dist/chunk-7H3TKJUT.mjs
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
User
|
|
3
|
-
} from "./chunk-P4IRDGB4.mjs";
|
|
4
|
-
import {
|
|
5
|
-
Base
|
|
6
|
-
} from "./chunk-XNS4O6QJ.mjs";
|
|
7
|
-
|
|
8
|
-
// src/structures/Message.ts
|
|
9
|
-
import { Collection } from "@fluxer/collection";
|
|
10
|
-
import { Routes } from "@fluxer/types";
|
|
11
|
-
var Message = class _Message extends Base {
|
|
12
|
-
client;
|
|
13
|
-
id;
|
|
14
|
-
channelId;
|
|
15
|
-
guildId;
|
|
16
|
-
author;
|
|
17
|
-
content;
|
|
18
|
-
createdAt;
|
|
19
|
-
editedAt;
|
|
20
|
-
pinned;
|
|
21
|
-
attachments;
|
|
22
|
-
channel;
|
|
23
|
-
constructor(client, data) {
|
|
24
|
-
super();
|
|
25
|
-
this.client = client;
|
|
26
|
-
this.id = data.id;
|
|
27
|
-
this.channelId = data.channel_id;
|
|
28
|
-
this.guildId = data.guild_id ?? null;
|
|
29
|
-
this.author = new User(client, data.author);
|
|
30
|
-
this.content = data.content;
|
|
31
|
-
this.createdAt = new Date(data.timestamp);
|
|
32
|
-
this.editedAt = data.edited_timestamp ? new Date(data.edited_timestamp) : null;
|
|
33
|
-
this.pinned = data.pinned;
|
|
34
|
-
this.attachments = new Collection();
|
|
35
|
-
for (const a of data.attachments ?? []) this.attachments.set(a.id, a);
|
|
36
|
-
}
|
|
37
|
-
async reply(options) {
|
|
38
|
-
const body = typeof options === "string" ? { content: options, message_reference: { channel_id: this.channelId, message_id: this.id, guild_id: this.guildId ?? void 0 } } : { ...options, message_reference: { channel_id: this.channelId, message_id: this.id, guild_id: this.guildId ?? void 0 } };
|
|
39
|
-
const data = await this.client.rest.post(Routes.channelMessages(this.channelId), { body });
|
|
40
|
-
return new _Message(this.client, data);
|
|
41
|
-
}
|
|
42
|
-
async edit(options) {
|
|
43
|
-
const data = await this.client.rest.patch(Routes.channelMessage(this.channelId, this.id), { body: options });
|
|
44
|
-
return new _Message(this.client, data);
|
|
45
|
-
}
|
|
46
|
-
async delete() {
|
|
47
|
-
await this.client.rest.delete(Routes.channelMessage(this.channelId, this.id));
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export {
|
|
52
|
-
Message
|
|
53
|
-
};
|