@zygout/eris 0.19.0 → 0.19.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/LICENSE +20 -20
- package/README.md +71 -80
- package/esm.mjs +72 -72
- package/index.d.ts +4407 -4397
- package/index.js +75 -75
- package/lib/Client.js +4708 -4683
- package/lib/Constants.d.ts +990 -988
- package/lib/Constants.js +1163 -1161
- package/lib/command/Command.js +552 -552
- package/lib/command/CommandClient.js +460 -460
- package/lib/errors/DiscordHTTPError.js +63 -63
- package/lib/errors/DiscordRESTError.js +77 -77
- package/lib/gateway/Shard.js +3029 -3029
- package/lib/gateway/ShardManager.js +164 -164
- package/lib/rest/Endpoints.js +172 -172
- package/lib/rest/RequestHandler.js +459 -459
- package/lib/structures/ApplicationCommand.js +125 -125
- package/lib/structures/AutoModerationRule.js +143 -143
- package/lib/structures/AutocompleteInteraction.js +80 -80
- package/lib/structures/Base.js +81 -81
- package/lib/structures/CategoryChannel.js +77 -77
- package/lib/structures/Channel.js +98 -98
- package/lib/structures/CommandInteraction.js +473 -473
- package/lib/structures/ComponentInteraction.js +538 -538
- package/lib/structures/DMChannel.js +278 -278
- package/lib/structures/Entitlement.js +77 -77
- package/lib/structures/ExtendedUser.js +46 -46
- package/lib/structures/ForumChannel.js +24 -24
- package/lib/structures/GroupChannel.js +106 -106
- package/lib/structures/Guild.js +1677 -1677
- package/lib/structures/GuildAuditLogEntry.js +190 -190
- package/lib/structures/GuildChannel.js +128 -128
- package/lib/structures/GuildIntegration.js +99 -99
- package/lib/structures/GuildPreview.js +97 -97
- package/lib/structures/GuildScheduledEvent.js +176 -176
- package/lib/structures/GuildTemplate.js +76 -76
- package/lib/structures/GuildTextableChannel.js +260 -260
- package/lib/structures/Interaction.js +133 -133
- package/lib/structures/Invite.js +143 -143
- package/lib/structures/Lobby.js +108 -108
- package/lib/structures/LobbyMember.js +59 -59
- package/lib/structures/MediaChannel.js +216 -216
- package/lib/structures/Member.js +371 -371
- package/lib/structures/Message.js +708 -708
- package/lib/structures/ModalSubmitInteraction.js +478 -478
- package/lib/structures/NewsChannel.js +34 -34
- package/lib/structures/NewsThreadChannel.js +12 -12
- package/lib/structures/Permission.js +80 -80
- package/lib/structures/PermissionOverwrite.js +32 -32
- package/lib/structures/PingInteraction.js +39 -39
- package/lib/structures/PrivateThreadChannel.js +25 -25
- package/lib/structures/PublicThreadChannel.js +26 -26
- package/lib/structures/Role.js +163 -163
- package/lib/structures/SKU.js +80 -80
- package/lib/structures/SoundboardSound.js +79 -79
- package/lib/structures/StageChannel.js +59 -59
- package/lib/structures/StageInstance.js +55 -55
- package/lib/structures/Subscription.js +69 -69
- package/lib/structures/TextChannel.js +202 -202
- package/lib/structures/ThreadChannel.js +143 -143
- package/lib/structures/ThreadMember.js +59 -59
- package/lib/structures/UnavailableGuild.js +26 -26
- package/lib/structures/UnknownInteraction.js +502 -502
- package/lib/structures/User.js +296 -296
- package/lib/structures/VoiceChannel.js +166 -166
- package/lib/structures/VoiceState.js +84 -84
- package/lib/util/BrowserWebSocket.js +76 -76
- package/lib/util/Bucket.js +89 -89
- package/lib/util/Collection.js +202 -202
- package/lib/util/MultipartData.js +70 -70
- package/lib/util/Opus.js +33 -33
- package/lib/util/SequentialBucket.js +83 -83
- package/lib/util/emitDeprecation.js +26 -26
- package/lib/voice/Piper.js +300 -300
- package/lib/voice/SharedStream.js +238 -238
- package/lib/voice/VoiceConnection.js +1440 -1440
- package/lib/voice/VoiceConnectionManager.js +151 -151
- package/lib/voice/VoiceDataStream.js +22 -22
- package/lib/voice/streams/BaseTransformer.js +40 -40
- package/lib/voice/streams/DCAOpusTransformer.js +78 -78
- package/lib/voice/streams/FFmpegDuplex.js +192 -192
- package/lib/voice/streams/FFmpegOggTransformer.js +35 -35
- package/lib/voice/streams/FFmpegPCMTransformer.js +26 -26
- package/lib/voice/streams/OggOpusTransformer.js +108 -108
- package/lib/voice/streams/PCMOpusTransformer.js +61 -61
- package/lib/voice/streams/VolumeTransformer.js +50 -50
- package/lib/voice/streams/WebmOpusTransformer.js +258 -258
- package/package.json +83 -82
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const Collection = require("../util/Collection");
|
|
4
|
-
const GuildTextableChannel = require("./GuildTextableChannel");
|
|
5
|
-
const ThreadMember = require("./ThreadMember");
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Represents a thread channel. You also probably want to look at NewsThreadChannel, PublicThreadChannel, and PrivateThreadChannel. See GuildTextableChannel for more properties and methods
|
|
9
|
-
* @extends GuildTextableChannel
|
|
10
|
-
* @prop {Number?} lastPinTimestamp The timestamp of the last pinned message
|
|
11
|
-
* @prop {ThreadMember} member Thread member for the current user, if they have joined the thread
|
|
12
|
-
* @prop {Number} memberCount The approximate number of users in the thread (stops counting at 50)
|
|
13
|
-
* @prop {Collection<ThreadMember>} members Collection of thread members in the channel
|
|
14
|
-
* @prop {Number} messageCount The number of messages (excluding starter and deleted messages) in the thread
|
|
15
|
-
* @prop {String} ownerID The ID of the user that created the thread
|
|
16
|
-
* @prop {Object} threadMetadata Metadata for the thread
|
|
17
|
-
* @prop {Boolean} threadMetadata.archived Whether the thread is archived or not
|
|
18
|
-
* @prop {Number} threadMetadata.archiveTimestamp Timestamp of when the thread's archive status was last changed, used for calculating recent activity
|
|
19
|
-
* @prop {Number} threadMetadata.autoArchiveDuration Duration in minutes to automatically hide the thread after recent activity, either 60, 1440, 4320, or 10080
|
|
20
|
-
* @prop {Number?} threadMetadata.createTimestamp Timestamp when the thread was created (only available for threads created after 09 January 2022)
|
|
21
|
-
* @prop {Boolean} threadMetadata.locked Whether the thread is locked or not
|
|
22
|
-
* @prop {Number} totalMessageSent Total number of messages ever sent in the thread (will not decrement)
|
|
23
|
-
*/
|
|
24
|
-
class ThreadChannel extends GuildTextableChannel {
|
|
25
|
-
constructor(data, client) {
|
|
26
|
-
super(data, client);
|
|
27
|
-
this.members = new Collection(ThreadMember);
|
|
28
|
-
this.ownerID = data.owner_id;
|
|
29
|
-
this.update(data);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
update(data) {
|
|
33
|
-
super.update(data);
|
|
34
|
-
if (data.message_count !== undefined) {
|
|
35
|
-
this.messageCount = data.message_count;
|
|
36
|
-
}
|
|
37
|
-
if (data.member_count !== undefined) {
|
|
38
|
-
this.memberCount = data.member_count;
|
|
39
|
-
}
|
|
40
|
-
if (data.thread_metadata !== undefined) {
|
|
41
|
-
this.threadMetadata = {
|
|
42
|
-
archived: data.thread_metadata.archived,
|
|
43
|
-
archiveTimestamp: Date.parse(data.thread_metadata.archive_timestamp),
|
|
44
|
-
autoArchiveDuration: data.thread_metadata.auto_archive_duration,
|
|
45
|
-
locked: data.thread_metadata.locked,
|
|
46
|
-
};
|
|
47
|
-
if (data.thread_metadata.create_timestamp !== undefined) {
|
|
48
|
-
this.threadMetadata.createTimestamp = Date.parse(data.thread_metadata.create_timestamp) || null;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (data.total_message_sent !== undefined) {
|
|
52
|
-
this.totalMessageSent = data.total_message_sent;
|
|
53
|
-
}
|
|
54
|
-
if (data.member !== undefined) {
|
|
55
|
-
this.member = new ThreadMember(data.member, this._client);
|
|
56
|
-
}
|
|
57
|
-
this.lastPinTimestamp = data.last_pin_timestamp ? Date.parse(data.last_pin_timestamp) : null;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Get a member that is part of the thread channel
|
|
62
|
-
* @arg {String} userID The ID of the user
|
|
63
|
-
* @arg {Boolean} [withMember] Whether to include the guild member object within the response
|
|
64
|
-
* @returns {Promise<ThreadMember>}
|
|
65
|
-
*/
|
|
66
|
-
getMember(userID, withMember) {
|
|
67
|
-
return this._client.getThreadMember.call(this._client, this.id, userID, withMember);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Get a list of members that are part of this thread channel
|
|
72
|
-
* @arg {Object} [options] Options for the request
|
|
73
|
-
* @arg {String} [options.after] Get members after this user ID
|
|
74
|
-
* @arg {Number} [options.limit=100] The maximum number of thread members to fetch (1-100)
|
|
75
|
-
* @arg {Boolean} [options.withMember] Whether to include the guild member object for each member of the thread
|
|
76
|
-
* @returns {Promise<Array<ThreadMember>>}
|
|
77
|
-
*/
|
|
78
|
-
getMembers(options) {
|
|
79
|
-
return this._client.getThreadMembers.call(this._client, this.id, options);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Get pinned messages in the thread channel
|
|
84
|
-
* @arg {Object} [options] The options to use to get pinned messages
|
|
85
|
-
* @arg {Date} [options.before] Get pinned messages before this date
|
|
86
|
-
* @arg {Number} [options.limit=50] The max number of pinned messages to get (1-50, default 50)
|
|
87
|
-
* @returns {Promise<{hasMore: Boolean, items: Array<{pinnedAt: Number, message: Message}>}>}
|
|
88
|
-
*/
|
|
89
|
-
getPins(options) {
|
|
90
|
-
return this._client.getPins.call(this._client, this.id, options);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Join a thread
|
|
95
|
-
* @arg {String} [userID="@me"] The user ID of the user joining
|
|
96
|
-
* @returns {Promise}
|
|
97
|
-
*/
|
|
98
|
-
join(userID) {
|
|
99
|
-
return this._client.joinThread.call(this._client, this.id, userID);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Leave a thread
|
|
104
|
-
* @arg {String} [userID="@me"] The user ID of the user leaving
|
|
105
|
-
* @returns {Promise}
|
|
106
|
-
*/
|
|
107
|
-
leave(userID) {
|
|
108
|
-
return this._client.leaveThread.call(this._client, this.id, userID);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Pin a message
|
|
113
|
-
* @arg {String} messageID The ID of the message
|
|
114
|
-
* @returns {Promise}
|
|
115
|
-
*/
|
|
116
|
-
pinMessage(messageID) {
|
|
117
|
-
return this._client.pinMessage.call(this._client, this.id, messageID);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Unpin a message
|
|
122
|
-
* @arg {String} messageID The ID of the message
|
|
123
|
-
* @returns {Promise}
|
|
124
|
-
*/
|
|
125
|
-
unpinMessage(messageID) {
|
|
126
|
-
return this._client.unpinMessage.call(this._client, this.id, messageID);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
toJSON(props = []) {
|
|
130
|
-
return super.toJSON([
|
|
131
|
-
"member",
|
|
132
|
-
"memberCount",
|
|
133
|
-
"members",
|
|
134
|
-
"messageCount",
|
|
135
|
-
"ownerID",
|
|
136
|
-
"threadMetadata",
|
|
137
|
-
"totalMessageSent",
|
|
138
|
-
...props,
|
|
139
|
-
]);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
module.exports = ThreadChannel;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const Collection = require("../util/Collection");
|
|
4
|
+
const GuildTextableChannel = require("./GuildTextableChannel");
|
|
5
|
+
const ThreadMember = require("./ThreadMember");
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Represents a thread channel. You also probably want to look at NewsThreadChannel, PublicThreadChannel, and PrivateThreadChannel. See GuildTextableChannel for more properties and methods
|
|
9
|
+
* @extends GuildTextableChannel
|
|
10
|
+
* @prop {Number?} lastPinTimestamp The timestamp of the last pinned message
|
|
11
|
+
* @prop {ThreadMember} member Thread member for the current user, if they have joined the thread
|
|
12
|
+
* @prop {Number} memberCount The approximate number of users in the thread (stops counting at 50)
|
|
13
|
+
* @prop {Collection<ThreadMember>} members Collection of thread members in the channel
|
|
14
|
+
* @prop {Number} messageCount The number of messages (excluding starter and deleted messages) in the thread
|
|
15
|
+
* @prop {String} ownerID The ID of the user that created the thread
|
|
16
|
+
* @prop {Object} threadMetadata Metadata for the thread
|
|
17
|
+
* @prop {Boolean} threadMetadata.archived Whether the thread is archived or not
|
|
18
|
+
* @prop {Number} threadMetadata.archiveTimestamp Timestamp of when the thread's archive status was last changed, used for calculating recent activity
|
|
19
|
+
* @prop {Number} threadMetadata.autoArchiveDuration Duration in minutes to automatically hide the thread after recent activity, either 60, 1440, 4320, or 10080
|
|
20
|
+
* @prop {Number?} threadMetadata.createTimestamp Timestamp when the thread was created (only available for threads created after 09 January 2022)
|
|
21
|
+
* @prop {Boolean} threadMetadata.locked Whether the thread is locked or not
|
|
22
|
+
* @prop {Number} totalMessageSent Total number of messages ever sent in the thread (will not decrement)
|
|
23
|
+
*/
|
|
24
|
+
class ThreadChannel extends GuildTextableChannel {
|
|
25
|
+
constructor(data, client) {
|
|
26
|
+
super(data, client);
|
|
27
|
+
this.members = new Collection(ThreadMember);
|
|
28
|
+
this.ownerID = data.owner_id;
|
|
29
|
+
this.update(data);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
update(data) {
|
|
33
|
+
super.update(data);
|
|
34
|
+
if (data.message_count !== undefined) {
|
|
35
|
+
this.messageCount = data.message_count;
|
|
36
|
+
}
|
|
37
|
+
if (data.member_count !== undefined) {
|
|
38
|
+
this.memberCount = data.member_count;
|
|
39
|
+
}
|
|
40
|
+
if (data.thread_metadata !== undefined) {
|
|
41
|
+
this.threadMetadata = {
|
|
42
|
+
archived: data.thread_metadata.archived,
|
|
43
|
+
archiveTimestamp: Date.parse(data.thread_metadata.archive_timestamp),
|
|
44
|
+
autoArchiveDuration: data.thread_metadata.auto_archive_duration,
|
|
45
|
+
locked: data.thread_metadata.locked,
|
|
46
|
+
};
|
|
47
|
+
if (data.thread_metadata.create_timestamp !== undefined) {
|
|
48
|
+
this.threadMetadata.createTimestamp = Date.parse(data.thread_metadata.create_timestamp) || null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (data.total_message_sent !== undefined) {
|
|
52
|
+
this.totalMessageSent = data.total_message_sent;
|
|
53
|
+
}
|
|
54
|
+
if (data.member !== undefined) {
|
|
55
|
+
this.member = new ThreadMember(data.member, this._client);
|
|
56
|
+
}
|
|
57
|
+
this.lastPinTimestamp = data.last_pin_timestamp ? Date.parse(data.last_pin_timestamp) : null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Get a member that is part of the thread channel
|
|
62
|
+
* @arg {String} userID The ID of the user
|
|
63
|
+
* @arg {Boolean} [withMember] Whether to include the guild member object within the response
|
|
64
|
+
* @returns {Promise<ThreadMember>}
|
|
65
|
+
*/
|
|
66
|
+
getMember(userID, withMember) {
|
|
67
|
+
return this._client.getThreadMember.call(this._client, this.id, userID, withMember);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Get a list of members that are part of this thread channel
|
|
72
|
+
* @arg {Object} [options] Options for the request
|
|
73
|
+
* @arg {String} [options.after] Get members after this user ID
|
|
74
|
+
* @arg {Number} [options.limit=100] The maximum number of thread members to fetch (1-100)
|
|
75
|
+
* @arg {Boolean} [options.withMember] Whether to include the guild member object for each member of the thread
|
|
76
|
+
* @returns {Promise<Array<ThreadMember>>}
|
|
77
|
+
*/
|
|
78
|
+
getMembers(options) {
|
|
79
|
+
return this._client.getThreadMembers.call(this._client, this.id, options);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Get pinned messages in the thread channel
|
|
84
|
+
* @arg {Object} [options] The options to use to get pinned messages
|
|
85
|
+
* @arg {Date} [options.before] Get pinned messages before this date
|
|
86
|
+
* @arg {Number} [options.limit=50] The max number of pinned messages to get (1-50, default 50)
|
|
87
|
+
* @returns {Promise<{hasMore: Boolean, items: Array<{pinnedAt: Number, message: Message}>}>}
|
|
88
|
+
*/
|
|
89
|
+
getPins(options) {
|
|
90
|
+
return this._client.getPins.call(this._client, this.id, options);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Join a thread
|
|
95
|
+
* @arg {String} [userID="@me"] The user ID of the user joining
|
|
96
|
+
* @returns {Promise}
|
|
97
|
+
*/
|
|
98
|
+
join(userID) {
|
|
99
|
+
return this._client.joinThread.call(this._client, this.id, userID);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Leave a thread
|
|
104
|
+
* @arg {String} [userID="@me"] The user ID of the user leaving
|
|
105
|
+
* @returns {Promise}
|
|
106
|
+
*/
|
|
107
|
+
leave(userID) {
|
|
108
|
+
return this._client.leaveThread.call(this._client, this.id, userID);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Pin a message
|
|
113
|
+
* @arg {String} messageID The ID of the message
|
|
114
|
+
* @returns {Promise}
|
|
115
|
+
*/
|
|
116
|
+
pinMessage(messageID) {
|
|
117
|
+
return this._client.pinMessage.call(this._client, this.id, messageID);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Unpin a message
|
|
122
|
+
* @arg {String} messageID The ID of the message
|
|
123
|
+
* @returns {Promise}
|
|
124
|
+
*/
|
|
125
|
+
unpinMessage(messageID) {
|
|
126
|
+
return this._client.unpinMessage.call(this._client, this.id, messageID);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
toJSON(props = []) {
|
|
130
|
+
return super.toJSON([
|
|
131
|
+
"member",
|
|
132
|
+
"memberCount",
|
|
133
|
+
"members",
|
|
134
|
+
"messageCount",
|
|
135
|
+
"ownerID",
|
|
136
|
+
"threadMetadata",
|
|
137
|
+
"totalMessageSent",
|
|
138
|
+
...props,
|
|
139
|
+
]);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
module.exports = ThreadChannel;
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const Base = require("./Base");
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Represents a thread member
|
|
7
|
-
* @prop {Number} flags The user-thread settings of this member
|
|
8
|
-
* @prop {Member?} guildMember The guild member that this thread member belongs to
|
|
9
|
-
* @prop {String} id The ID of the thread member
|
|
10
|
-
* @prop {Number} joinTimestamp Timestamp of when the member joined the thread
|
|
11
|
-
* @prop {String} threadID The ID of the thread this member is a part of
|
|
12
|
-
*/
|
|
13
|
-
class ThreadMember extends Base {
|
|
14
|
-
constructor(data, client) {
|
|
15
|
-
super(data.user_id);
|
|
16
|
-
this._client = client;
|
|
17
|
-
this.threadID = data.thread_id || data.id; // Thanks Discord
|
|
18
|
-
this.joinTimestamp = Date.parse(data.join_timestamp);
|
|
19
|
-
|
|
20
|
-
if (data.member !== undefined) {
|
|
21
|
-
const guild = this._client.guilds.get(this._client.threadGuildMap[this.threadID]);
|
|
22
|
-
if (data.user_id) {
|
|
23
|
-
data.member.id = data.user_id;
|
|
24
|
-
}
|
|
25
|
-
this.guildMember = guild.members.update(data.member, guild);
|
|
26
|
-
if (data.presence) {
|
|
27
|
-
this.guildMember.update(data.presence);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
this.update(data);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
update(data) {
|
|
35
|
-
if (data.flags !== undefined) {
|
|
36
|
-
this.flags = data.flags;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Remove the member from the thread
|
|
42
|
-
* @returns {Promise}
|
|
43
|
-
*/
|
|
44
|
-
leave() {
|
|
45
|
-
return this._client.leaveThread.call(this._client, this.threadID, this.id);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
toJSON(props = []) {
|
|
49
|
-
return super.toJSON([
|
|
50
|
-
"flags",
|
|
51
|
-
"guildMember",
|
|
52
|
-
"joinTimestamp",
|
|
53
|
-
"threadID",
|
|
54
|
-
...props,
|
|
55
|
-
]);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
module.exports = ThreadMember;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const Base = require("./Base");
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents a thread member
|
|
7
|
+
* @prop {Number} flags The user-thread settings of this member
|
|
8
|
+
* @prop {Member?} guildMember The guild member that this thread member belongs to
|
|
9
|
+
* @prop {String} id The ID of the thread member
|
|
10
|
+
* @prop {Number} joinTimestamp Timestamp of when the member joined the thread
|
|
11
|
+
* @prop {String} threadID The ID of the thread this member is a part of
|
|
12
|
+
*/
|
|
13
|
+
class ThreadMember extends Base {
|
|
14
|
+
constructor(data, client) {
|
|
15
|
+
super(data.user_id);
|
|
16
|
+
this._client = client;
|
|
17
|
+
this.threadID = data.thread_id || data.id; // Thanks Discord
|
|
18
|
+
this.joinTimestamp = Date.parse(data.join_timestamp);
|
|
19
|
+
|
|
20
|
+
if (data.member !== undefined) {
|
|
21
|
+
const guild = this._client.guilds.get(this._client.threadGuildMap[this.threadID]);
|
|
22
|
+
if (data.user_id) {
|
|
23
|
+
data.member.id = data.user_id;
|
|
24
|
+
}
|
|
25
|
+
this.guildMember = guild.members.update(data.member, guild);
|
|
26
|
+
if (data.presence) {
|
|
27
|
+
this.guildMember.update(data.presence);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
this.update(data);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
update(data) {
|
|
35
|
+
if (data.flags !== undefined) {
|
|
36
|
+
this.flags = data.flags;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Remove the member from the thread
|
|
42
|
+
* @returns {Promise}
|
|
43
|
+
*/
|
|
44
|
+
leave() {
|
|
45
|
+
return this._client.leaveThread.call(this._client, this.threadID, this.id);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
toJSON(props = []) {
|
|
49
|
+
return super.toJSON([
|
|
50
|
+
"flags",
|
|
51
|
+
"guildMember",
|
|
52
|
+
"joinTimestamp",
|
|
53
|
+
"threadID",
|
|
54
|
+
...props,
|
|
55
|
+
]);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = ThreadMember;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const Base = require("./Base");
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Represents a guild
|
|
7
|
-
* @prop {String} id The ID of the guild
|
|
8
|
-
* @prop {Shard} shard The Shard that owns the guild
|
|
9
|
-
* @prop {Boolean} unavailable Whether the guild is unavailable or not
|
|
10
|
-
*/
|
|
11
|
-
class UnavailableGuild extends Base {
|
|
12
|
-
constructor(data, client) {
|
|
13
|
-
super(data.id);
|
|
14
|
-
this.shard = client.shards.get(client.guildShardMap[this.id]);
|
|
15
|
-
this.unavailable = !!data.unavailable;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
toJSON(props = []) {
|
|
19
|
-
return super.toJSON([
|
|
20
|
-
"unavailable",
|
|
21
|
-
...props,
|
|
22
|
-
]);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
module.exports = UnavailableGuild;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const Base = require("./Base");
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents a guild
|
|
7
|
+
* @prop {String} id The ID of the guild
|
|
8
|
+
* @prop {Shard} shard The Shard that owns the guild
|
|
9
|
+
* @prop {Boolean} unavailable Whether the guild is unavailable or not
|
|
10
|
+
*/
|
|
11
|
+
class UnavailableGuild extends Base {
|
|
12
|
+
constructor(data, client) {
|
|
13
|
+
super(data.id);
|
|
14
|
+
this.shard = client.shards.get(client.guildShardMap[this.id]);
|
|
15
|
+
this.unavailable = !!data.unavailable;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
toJSON(props = []) {
|
|
19
|
+
return super.toJSON([
|
|
20
|
+
"unavailable",
|
|
21
|
+
...props,
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = UnavailableGuild;
|