@fluxerjs/core 1.0.2
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/README.md +26 -0
- package/dist/Channel-HM2UY4DN.mjs +17 -0
- package/dist/Channel-TOAQGSRX.mjs +17 -0
- package/dist/ClientUser-RNDKHQ3Z.mjs +9 -0
- package/dist/Guild-36EGAAEW.mjs +8 -0
- package/dist/Guild-GOQZ7XP4.mjs +8 -0
- package/dist/GuildMember-RGVPVUAG.mjs +9 -0
- package/dist/Message-23Z3RPCZ.mjs +9 -0
- package/dist/Message-XB5WNMHL.mjs +9 -0
- package/dist/chunk-6CEMF2LO.mjs +14 -0
- package/dist/chunk-6EBNOON4.mjs +86 -0
- package/dist/chunk-7H3TKJUT.mjs +53 -0
- package/dist/chunk-F2EEQP5O.mjs +86 -0
- package/dist/chunk-GUNWHOQO.mjs +42 -0
- package/dist/chunk-HQMYRYMY.mjs +6 -0
- package/dist/chunk-LBBIQOSH.mjs +53 -0
- package/dist/chunk-P4IRDGB4.mjs +43 -0
- package/dist/chunk-TE5IC7IP.mjs +36 -0
- package/dist/chunk-WFONGZGK.mjs +42 -0
- package/dist/chunk-XNS4O6QJ.mjs +7 -0
- package/dist/index.d.mts +228 -0
- package/dist/index.d.ts +228 -0
- package/dist/index.js +665 -0
- package/dist/index.mjs +329 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @fluxerjs/core
|
|
2
|
+
|
|
3
|
+
Main client for the Fluxer bot SDK.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @fluxerjs/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
import { Client, Events } from '@fluxerjs/core';
|
|
15
|
+
|
|
16
|
+
const client = new Client({ intents: 0 });
|
|
17
|
+
|
|
18
|
+
client.on(Events.Ready, () => console.log('Ready'));
|
|
19
|
+
client.on(Events.MessageCreate, async (m) => {
|
|
20
|
+
if (m.content === '!ping') await m.reply('Pong');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
await client.login(process.env.FLUXER_BOT_TOKEN);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
For voice, add `@fluxerjs/voice`. For embeds, use `EmbedBuilder`.
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Base
|
|
3
|
+
} from "./chunk-XNS4O6QJ.mjs";
|
|
4
|
+
|
|
5
|
+
// src/structures/Channel.ts
|
|
6
|
+
import { ChannelType, Routes } from "@fluxerjs/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-23Z3RPCZ.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
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
var Guild = class extends Base {
|
|
11
|
+
client;
|
|
12
|
+
id;
|
|
13
|
+
name;
|
|
14
|
+
icon;
|
|
15
|
+
banner;
|
|
16
|
+
ownerId;
|
|
17
|
+
members = new Collection();
|
|
18
|
+
channels = new Collection();
|
|
19
|
+
constructor(client, data) {
|
|
20
|
+
super();
|
|
21
|
+
this.client = client;
|
|
22
|
+
this.id = data.id;
|
|
23
|
+
this.name = data.name;
|
|
24
|
+
this.icon = data.icon ?? null;
|
|
25
|
+
this.banner = data.banner ?? null;
|
|
26
|
+
this.ownerId = data.owner_id;
|
|
27
|
+
}
|
|
28
|
+
iconURL(options) {
|
|
29
|
+
if (!this.icon) return null;
|
|
30
|
+
const size = options?.size ? `?size=${options.size}` : "";
|
|
31
|
+
return `${CDN_URL}/icons/${this.id}/${this.icon}.png${size}`;
|
|
32
|
+
}
|
|
33
|
+
bannerURL(options) {
|
|
34
|
+
if (!this.banner) return null;
|
|
35
|
+
const size = options?.size ? `?size=${options.size}` : "";
|
|
36
|
+
return `${CDN_URL}/banners/${this.id}/${this.banner}.png${size}`;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
Guild
|
|
42
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
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
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CDN_URL
|
|
3
|
+
} from "./chunk-HQMYRYMY.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Base
|
|
6
|
+
} from "./chunk-XNS4O6QJ.mjs";
|
|
7
|
+
|
|
8
|
+
// src/structures/User.ts
|
|
9
|
+
var User = class extends Base {
|
|
10
|
+
client;
|
|
11
|
+
id;
|
|
12
|
+
username;
|
|
13
|
+
discriminator;
|
|
14
|
+
globalName;
|
|
15
|
+
avatar;
|
|
16
|
+
bot;
|
|
17
|
+
constructor(client, data) {
|
|
18
|
+
super();
|
|
19
|
+
this.client = client;
|
|
20
|
+
this.id = data.id;
|
|
21
|
+
this.username = data.username;
|
|
22
|
+
this.discriminator = data.discriminator;
|
|
23
|
+
this.globalName = data.global_name ?? null;
|
|
24
|
+
this.avatar = data.avatar ?? null;
|
|
25
|
+
this.bot = !!data.bot;
|
|
26
|
+
}
|
|
27
|
+
avatarURL(options) {
|
|
28
|
+
if (!this.avatar) return null;
|
|
29
|
+
const ext = options?.extension ?? "png";
|
|
30
|
+
const size = options?.size ? `?size=${options.size}` : "";
|
|
31
|
+
return `${CDN_URL}/avatars/${this.id}/${this.avatar}.${ext}${size}`;
|
|
32
|
+
}
|
|
33
|
+
displayAvatarURL(options) {
|
|
34
|
+
return this.avatarURL(options) ?? `${CDN_URL}/avatars/0/0.png`;
|
|
35
|
+
}
|
|
36
|
+
toString() {
|
|
37
|
+
return `<@${this.id}>`;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
User
|
|
43
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
User
|
|
3
|
+
} from "./chunk-P4IRDGB4.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Base
|
|
6
|
+
} from "./chunk-XNS4O6QJ.mjs";
|
|
7
|
+
|
|
8
|
+
// src/structures/GuildMember.ts
|
|
9
|
+
var GuildMember = class extends Base {
|
|
10
|
+
client;
|
|
11
|
+
id;
|
|
12
|
+
user;
|
|
13
|
+
guild;
|
|
14
|
+
nick;
|
|
15
|
+
roles;
|
|
16
|
+
joinedAt;
|
|
17
|
+
communicationDisabledUntil;
|
|
18
|
+
constructor(client, data, guild) {
|
|
19
|
+
super();
|
|
20
|
+
this.client = client;
|
|
21
|
+
this.user = new User(client, data.user);
|
|
22
|
+
this.id = data.user.id;
|
|
23
|
+
this.guild = guild;
|
|
24
|
+
this.nick = data.nick ?? null;
|
|
25
|
+
this.roles = data.roles ?? [];
|
|
26
|
+
this.joinedAt = new Date(data.joined_at);
|
|
27
|
+
this.communicationDisabledUntil = data.communication_disabled_until ? new Date(data.communication_disabled_until) : null;
|
|
28
|
+
}
|
|
29
|
+
get displayName() {
|
|
30
|
+
return this.nick ?? this.user.globalName ?? this.user.username;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
GuildMember
|
|
36
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
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 "@fluxer/collection";
|
|
10
|
+
var Guild = class extends Base {
|
|
11
|
+
client;
|
|
12
|
+
id;
|
|
13
|
+
name;
|
|
14
|
+
icon;
|
|
15
|
+
banner;
|
|
16
|
+
ownerId;
|
|
17
|
+
members = new Collection();
|
|
18
|
+
channels = new Collection();
|
|
19
|
+
constructor(client, data) {
|
|
20
|
+
super();
|
|
21
|
+
this.client = client;
|
|
22
|
+
this.id = data.id;
|
|
23
|
+
this.name = data.name;
|
|
24
|
+
this.icon = data.icon ?? null;
|
|
25
|
+
this.banner = data.banner ?? null;
|
|
26
|
+
this.ownerId = data.owner_id;
|
|
27
|
+
}
|
|
28
|
+
iconURL(options) {
|
|
29
|
+
if (!this.icon) return null;
|
|
30
|
+
const size = options?.size ? `?size=${options.size}` : "";
|
|
31
|
+
return `${CDN_URL}/icons/${this.id}/${this.icon}.png${size}`;
|
|
32
|
+
}
|
|
33
|
+
bannerURL(options) {
|
|
34
|
+
if (!this.banner) return null;
|
|
35
|
+
const size = options?.size ? `?size=${options.size}` : "";
|
|
36
|
+
return `${CDN_URL}/banners/${this.id}/${this.banner}.png${size}`;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
Guild
|
|
42
|
+
};
|