oceanic.js 0.0.12-dev.bcdbabd → 1.0.0-dev.123d33c
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/CONTRIBUTING.md +1 -1
- package/README.md +4 -4
- package/dist/lib/Client.js +10 -10
- package/dist/lib/Constants.d.ts +2 -2
- package/dist/lib/Constants.js +4 -4
- package/dist/lib/gateway/Shard.js +280 -266
- package/dist/lib/gateway/ShardManager.js +3 -3
- package/dist/lib/rest/Bucket.js +2 -2
- package/dist/lib/rest/DiscordHTTPError.js +1 -1
- package/dist/lib/rest/DiscordRESTError.js +1 -1
- package/dist/lib/rest/RequestHandler.js +8 -8
- package/dist/lib/rest/SequentialBucket.js +1 -1
- package/dist/lib/routes/Channels.d.ts +2 -2
- package/dist/lib/routes/Channels.js +1 -1
- package/dist/lib/routes/Guilds.d.ts +2 -2
- package/dist/lib/routes/Guilds.js +4 -3
- package/dist/lib/routes/OAuth.js +2 -2
- package/dist/lib/structures/AnnouncementChannel.d.ts +1 -1
- package/dist/lib/structures/Application.d.ts +5 -3
- package/dist/lib/structures/Application.js +14 -6
- package/dist/lib/structures/ApplicationCommand.d.ts +5 -4
- package/dist/lib/structures/ApplicationCommand.js +15 -12
- package/dist/lib/structures/AuditLogEntry.d.ts +3 -0
- package/dist/lib/structures/AuditLogEntry.js +4 -1
- package/dist/lib/structures/AutoModerationRule.d.ts +5 -4
- package/dist/lib/structures/AutoModerationRule.js +15 -7
- package/dist/lib/structures/AutocompleteInteraction.d.ts +5 -3
- package/dist/lib/structures/AutocompleteInteraction.js +11 -10
- package/dist/lib/structures/CategoryChannel.d.ts +1 -1
- package/dist/lib/structures/CategoryChannel.js +8 -5
- package/dist/lib/structures/CommandInteraction.d.ts +5 -3
- package/dist/lib/structures/CommandInteraction.js +19 -17
- package/dist/lib/structures/ComponentInteraction.d.ts +5 -3
- package/dist/lib/structures/ComponentInteraction.js +18 -17
- package/dist/lib/structures/ForumChannel.d.ts +6 -3
- package/dist/lib/structures/ForumChannel.js +13 -7
- package/dist/lib/structures/GroupChannel.d.ts +12 -7
- package/dist/lib/structures/GroupChannel.js +23 -13
- package/dist/lib/structures/Guild.d.ts +26 -13
- package/dist/lib/structures/Guild.js +69 -39
- package/dist/lib/structures/GuildChannel.d.ts +4 -3
- package/dist/lib/structures/GuildChannel.js +16 -9
- package/dist/lib/structures/GuildPreview.js +2 -2
- package/dist/lib/structures/GuildScheduledEvent.d.ts +6 -3
- package/dist/lib/structures/GuildScheduledEvent.js +20 -9
- package/dist/lib/structures/GuildTemplate.d.ts +3 -2
- package/dist/lib/structures/GuildTemplate.js +19 -6
- package/dist/lib/structures/Integration.js +2 -3
- package/dist/lib/structures/Interaction.d.ts +4 -3
- package/dist/lib/structures/Interaction.js +7 -4
- package/dist/lib/structures/Invite.d.ts +8 -4
- package/dist/lib/structures/Invite.js +18 -7
- package/dist/lib/structures/Member.d.ts +3 -2
- package/dist/lib/structures/Member.js +18 -18
- package/dist/lib/structures/Message.d.ts +19 -7
- package/dist/lib/structures/Message.js +53 -37
- package/dist/lib/structures/ModalSubmitInteraction.d.ts +5 -3
- package/dist/lib/structures/ModalSubmitInteraction.js +18 -17
- package/dist/lib/structures/Permission.d.ts +1 -1
- package/dist/lib/structures/Permission.js +6 -6
- package/dist/lib/structures/PrivateChannel.d.ts +4 -3
- package/dist/lib/structures/PrivateChannel.js +8 -5
- package/dist/lib/structures/Role.d.ts +3 -2
- package/dist/lib/structures/Role.js +16 -8
- package/dist/lib/structures/StageChannel.d.ts +2 -2
- package/dist/lib/structures/StageChannel.js +8 -5
- package/dist/lib/structures/StageInstance.d.ts +8 -5
- package/dist/lib/structures/StageInstance.js +23 -9
- package/dist/lib/structures/Team.d.ts +4 -3
- package/dist/lib/structures/Team.js +9 -6
- package/dist/lib/structures/TextableChannel.d.ts +8 -7
- package/dist/lib/structures/TextableChannel.js +15 -9
- package/dist/lib/structures/ThreadChannel.d.ts +10 -7
- package/dist/lib/structures/ThreadChannel.js +23 -12
- package/dist/lib/structures/VoiceChannel.d.ts +4 -3
- package/dist/lib/structures/VoiceChannel.js +7 -4
- package/dist/lib/structures/VoiceState.d.ts +5 -3
- package/dist/lib/structures/VoiceState.js +13 -13
- package/dist/lib/structures/Webhook.d.ts +7 -4
- package/dist/lib/structures/Webhook.js +22 -16
- package/dist/lib/types/application-commands.d.ts +3 -2
- package/dist/lib/types/channels.d.ts +1 -1
- package/dist/lib/types/client.d.ts +1 -1
- package/dist/lib/types/events.d.ts +22 -22
- package/dist/lib/types/gateway.d.ts +2 -2
- package/dist/lib/types/json.d.ts +46 -46
- package/dist/lib/types/scheduled-events.d.ts +2 -2
- package/dist/lib/util/InteractionOptionsWrapper.js +1 -1
- package/dist/lib/util/Routes.js +1 -1
- package/dist/lib/util/TypedCollection.js +3 -3
- package/dist/lib/util/Util.d.ts +1 -1
- package/dist/lib/util/Util.js +12 -2
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const Base_1 = __importDefault(require("./Base"));
|
|
7
|
-
const Member_1 = __importDefault(require("./Member"));
|
|
8
7
|
/** Represents a guild member's voice state. */
|
|
9
8
|
class VoiceState extends Base_1.default {
|
|
10
9
|
/** The channel the user is connected to. */
|
|
@@ -37,11 +36,15 @@ class VoiceState extends Base_1.default {
|
|
|
37
36
|
suppress;
|
|
38
37
|
/** The user associated with this voice state. */
|
|
39
38
|
user;
|
|
39
|
+
/** The ID of the user associated with this voice state. */
|
|
40
|
+
userID;
|
|
40
41
|
constructor(data, client) {
|
|
41
42
|
super(data.user_id, client);
|
|
42
43
|
this.channel = null;
|
|
43
44
|
this.channelID = data.channel_id;
|
|
44
45
|
this.deaf = false;
|
|
46
|
+
this.guild = data.guild_id === undefined ? undefined : client.guilds.get(data.guild_id);
|
|
47
|
+
this.guildID = data.guild_id;
|
|
45
48
|
this.mute = false;
|
|
46
49
|
this.requestToSpeakTimestamp = null;
|
|
47
50
|
this.selfDeaf = false;
|
|
@@ -50,27 +53,23 @@ class VoiceState extends Base_1.default {
|
|
|
50
53
|
this.selfVideo = false;
|
|
51
54
|
this.suppress = false;
|
|
52
55
|
this.user = client.users.get(this.id);
|
|
56
|
+
this.userID = this.id;
|
|
53
57
|
this.update(data);
|
|
54
58
|
}
|
|
55
59
|
update(data) {
|
|
56
60
|
if (data.channel_id !== undefined) {
|
|
57
61
|
this.channelID = data.channel_id;
|
|
58
|
-
|
|
59
|
-
this.channel = null;
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
this.channel = this.client.getChannel(data.channel_id);
|
|
63
|
-
}
|
|
62
|
+
this.channel = data.channel_id === null ? null : this.client.getChannel(data.channel_id);
|
|
64
63
|
}
|
|
65
64
|
if (data.deaf !== undefined) {
|
|
66
65
|
this.deaf = data.deaf;
|
|
67
66
|
}
|
|
68
67
|
if (data.guild_id !== undefined) {
|
|
69
|
-
this.guildID = data.guild_id;
|
|
70
68
|
this.guild = this.client.guilds.get(data.guild_id);
|
|
69
|
+
this.guildID = data.guild_id;
|
|
71
70
|
}
|
|
72
71
|
if (data.member !== undefined) {
|
|
73
|
-
this.member = this.
|
|
72
|
+
this.member = this.client.util.updateMember(data.guild_id, this.id, data.member);
|
|
74
73
|
}
|
|
75
74
|
if (data.mute !== undefined) {
|
|
76
75
|
this.mute = data.mute;
|
|
@@ -95,14 +94,15 @@ class VoiceState extends Base_1.default {
|
|
|
95
94
|
}
|
|
96
95
|
if (data.user_id !== undefined) {
|
|
97
96
|
this.user = this.client.users.get(data.user_id);
|
|
97
|
+
this.userID = data.user_id;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
toJSON() {
|
|
101
101
|
return {
|
|
102
102
|
...super.toJSON(),
|
|
103
|
-
|
|
103
|
+
channelID: this.channelID,
|
|
104
104
|
deaf: this.deaf,
|
|
105
|
-
|
|
105
|
+
guildID: this.guildID ?? undefined,
|
|
106
106
|
member: this.member?.toJSON(),
|
|
107
107
|
mute: this.mute,
|
|
108
108
|
requestToSpeakTimestamp: this.requestToSpeakTimestamp ? this.requestToSpeakTimestamp.getTime() : null,
|
|
@@ -112,9 +112,9 @@ class VoiceState extends Base_1.default {
|
|
|
112
112
|
selfVideo: this.selfVideo,
|
|
113
113
|
sessionID: this.sessionID,
|
|
114
114
|
suppress: this.suppress,
|
|
115
|
-
user: this.user
|
|
115
|
+
user: this.user?.toJSON()
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
exports.default = VoiceState;
|
|
120
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
120
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVm9pY2VTdGF0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9zdHJ1Y3R1cmVzL1ZvaWNlU3RhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxrREFBMEI7QUFVMUIsK0NBQStDO0FBQy9DLE1BQXFCLFVBQVcsU0FBUSxjQUFJO0lBQ3hDLDRDQUE0QztJQUM1QyxPQUFPLENBQXNDO0lBQzdDLHNEQUFzRDtJQUN0RCxTQUFTLENBQWdCO0lBQ3pCLDRDQUE0QztJQUM1QyxJQUFJLENBQVU7SUFDZCwrQ0FBK0M7SUFDL0MsS0FBSyxDQUFTO0lBQ2QseURBQXlEO0lBQ3pELE9BQU8sQ0FBUztJQUNoQixtREFBbUQ7SUFDbkQsTUFBTSxDQUFVO0lBQ2hCLHlDQUF5QztJQUN6QyxJQUFJLENBQVU7SUFDZCxrRUFBa0U7SUFDbEUsdUJBQXVCLENBQWM7SUFDckMsaURBQWlEO0lBQ2pELFFBQVEsQ0FBVTtJQUNsQiw4Q0FBOEM7SUFDOUMsUUFBUSxDQUF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JQUFJLENBQUMsSUFBSSxFQUFFLE1BQU0sRUFBRTtTQUMvQyxDQUFDO0lBQ04sQ0FBQztDQUNKO0FBaEhELDZCQWdIQyJ9
|
|
@@ -8,17 +8,20 @@ import type { ImageFormat, WebhookTypes } from "../Constants";
|
|
|
8
8
|
import type { AnyGuildTextChannel, RawChannel } from "../types/channels";
|
|
9
9
|
import type { RawGuild } from "../types/guilds";
|
|
10
10
|
import type { DeleteWebhookMessageOptions, EditWebhookMessageOptions, EditWebhookOptions, ExecuteWebhookOptions, ExecuteWebhookWaitOptions, RawWebhook } from "../types/webhooks";
|
|
11
|
-
import type { Uncached } from "../types/shared";
|
|
12
11
|
import type { JSONWebhook } from "../types/json";
|
|
13
12
|
export default class Webhook extends Base {
|
|
14
13
|
/** The application associatd with this webhook. */
|
|
15
|
-
application
|
|
14
|
+
application?: ClientApplication | null;
|
|
15
|
+
/** The ID of the application associatd with this webhook. */
|
|
16
|
+
applicationID: string | null;
|
|
16
17
|
/** The hash of this webhook's avatar. */
|
|
17
18
|
avatar: string | null;
|
|
18
19
|
/** The channel this webhook is for, if applicable. */
|
|
19
|
-
channel
|
|
20
|
+
channel?: AnyGuildTextChannel | null;
|
|
21
|
+
/** The ID of the channel this webhook is for, if applicable. */
|
|
22
|
+
channelID: string | null;
|
|
20
23
|
/** The guild this webhook is for, if applicable. */
|
|
21
|
-
guild
|
|
24
|
+
guild?: Guild | null;
|
|
22
25
|
/** The id of the guild this webhook is in, if applicable. */
|
|
23
26
|
guildID: string | null;
|
|
24
27
|
/** The username of this webhook, if any. */
|
|
@@ -32,10 +32,14 @@ const Routes = __importStar(require("../util/Routes"));
|
|
|
32
32
|
class Webhook extends Base_1.default {
|
|
33
33
|
/** The application associatd with this webhook. */
|
|
34
34
|
application;
|
|
35
|
+
/** The ID of the application associatd with this webhook. */
|
|
36
|
+
applicationID;
|
|
35
37
|
/** The hash of this webhook's avatar. */
|
|
36
38
|
avatar;
|
|
37
39
|
/** The channel this webhook is for, if applicable. */
|
|
38
40
|
channel;
|
|
41
|
+
/** The ID of the channel this webhook is for, if applicable. */
|
|
42
|
+
channelID;
|
|
39
43
|
/** The guild this webhook is for, if applicable. */
|
|
40
44
|
guild;
|
|
41
45
|
/** The id of the guild this webhook is in, if applicable. */
|
|
@@ -54,17 +58,19 @@ class Webhook extends Base_1.default {
|
|
|
54
58
|
user;
|
|
55
59
|
constructor(data, client) {
|
|
56
60
|
super(data.id, client);
|
|
57
|
-
this.application = data.application_id === null ? null : client.application
|
|
61
|
+
this.application = data.application_id === null ? null : client.application.id === data.application_id ? client.application : undefined;
|
|
62
|
+
this.applicationID = data.application_id;
|
|
58
63
|
this.avatar = data.avatar ?? null;
|
|
59
|
-
this.channel = data.channel_id === null ? null : client.getChannel(data.channel_id)
|
|
60
|
-
this.
|
|
64
|
+
this.channel = data.channel_id === null ? null : client.getChannel(data.channel_id);
|
|
65
|
+
this.channelID = data.channel_id;
|
|
66
|
+
this.guild = data.guild_id === undefined || data.guild_id === null ? null : client.guilds.get(data.guild_id);
|
|
61
67
|
this.guildID = data.guild_id ?? null;
|
|
62
68
|
this.name = data.name;
|
|
63
69
|
this.sourceChannel = data.source_channel;
|
|
64
70
|
this.sourceGuild = data.source_guild;
|
|
65
71
|
this.token = data.token;
|
|
66
72
|
this.type = data.type;
|
|
67
|
-
this.user =
|
|
73
|
+
this.user = data.user === undefined ? null : client.users.update(data.user);
|
|
68
74
|
}
|
|
69
75
|
get url() {
|
|
70
76
|
return `${Constants_1.BASE_URL}${Routes.WEBHOOK(this.id, this.token)}`;
|
|
@@ -91,7 +97,7 @@ class Webhook extends Base_1.default {
|
|
|
91
97
|
* @param token The token for the webhook, if not already present.
|
|
92
98
|
*/
|
|
93
99
|
async deleteMessage(messageID, options, token) {
|
|
94
|
-
const t = this.token
|
|
100
|
+
const t = this.token ?? token;
|
|
95
101
|
if (!t) {
|
|
96
102
|
throw new Error("Token is not present on webhook, and was not provided in options.");
|
|
97
103
|
}
|
|
@@ -102,7 +108,7 @@ class Webhook extends Base_1.default {
|
|
|
102
108
|
* @param token The token for the webhook, if not already present.
|
|
103
109
|
*/
|
|
104
110
|
async deleteToken(token) {
|
|
105
|
-
const t = this.token
|
|
111
|
+
const t = this.token ?? token;
|
|
106
112
|
if (!t) {
|
|
107
113
|
throw new Error("Token is not present on webhook, and was not provided in options.");
|
|
108
114
|
}
|
|
@@ -123,7 +129,7 @@ class Webhook extends Base_1.default {
|
|
|
123
129
|
* @param options The options for editing the message.
|
|
124
130
|
*/
|
|
125
131
|
async editMessage(messageID, options, token) {
|
|
126
|
-
const t = this.token
|
|
132
|
+
const t = this.token ?? token;
|
|
127
133
|
if (!t) {
|
|
128
134
|
throw new Error("Token is not present on webhook, and was not provided in options.");
|
|
129
135
|
}
|
|
@@ -135,28 +141,28 @@ class Webhook extends Base_1.default {
|
|
|
135
141
|
* @param token The token for the webhook, if not already present.
|
|
136
142
|
*/
|
|
137
143
|
async editToken(options, token) {
|
|
138
|
-
const t = this.token
|
|
144
|
+
const t = this.token ?? token;
|
|
139
145
|
if (!t) {
|
|
140
146
|
throw new Error("Token is not present on webhook, and was not provided in options.");
|
|
141
147
|
}
|
|
142
148
|
return this.client.rest.webhooks.editToken(this.id, t, options);
|
|
143
149
|
}
|
|
144
150
|
async execute(options, token) {
|
|
145
|
-
const t = this.token
|
|
151
|
+
const t = this.token ?? token;
|
|
146
152
|
if (!t) {
|
|
147
153
|
throw new Error("Token is not present on webhook, and was not provided in options.");
|
|
148
154
|
}
|
|
149
155
|
return this.client.rest.webhooks.execute(this.id, t, options);
|
|
150
156
|
}
|
|
151
157
|
async executeGithub(options, token) {
|
|
152
|
-
const t = this.token
|
|
158
|
+
const t = this.token ?? token;
|
|
153
159
|
if (!t) {
|
|
154
160
|
throw new Error("Token is not present on webhook, and was not provided in options.");
|
|
155
161
|
}
|
|
156
162
|
return this.client.rest.webhooks.executeGithub(this.id, t, options);
|
|
157
163
|
}
|
|
158
164
|
async executeSlack(options, token) {
|
|
159
|
-
const t = this.token
|
|
165
|
+
const t = this.token ?? token;
|
|
160
166
|
if (!t) {
|
|
161
167
|
throw new Error("Token is not present on webhook, and was not provided in options.");
|
|
162
168
|
}
|
|
@@ -169,7 +175,7 @@ class Webhook extends Base_1.default {
|
|
|
169
175
|
* @param token The token for the webhook, if not already present.
|
|
170
176
|
*/
|
|
171
177
|
async getMessage(messageID, threadID, token) {
|
|
172
|
-
const t = this.token
|
|
178
|
+
const t = this.token ?? token;
|
|
173
179
|
if (!t) {
|
|
174
180
|
throw new Error("Token is not present on webhook, and was not provided in options.");
|
|
175
181
|
}
|
|
@@ -186,10 +192,10 @@ class Webhook extends Base_1.default {
|
|
|
186
192
|
toJSON() {
|
|
187
193
|
return {
|
|
188
194
|
...super.toJSON(),
|
|
189
|
-
|
|
195
|
+
applicationID: this.application?.id ?? null,
|
|
190
196
|
avatar: this.avatar,
|
|
191
|
-
|
|
192
|
-
|
|
197
|
+
channelID: this.channelID ?? null,
|
|
198
|
+
guildID: this.guildID,
|
|
193
199
|
name: this.name,
|
|
194
200
|
sourceChannel: this.sourceChannel,
|
|
195
201
|
sourceGuild: this.sourceGuild,
|
|
@@ -200,4 +206,4 @@ class Webhook extends Base_1.default {
|
|
|
200
206
|
}
|
|
201
207
|
}
|
|
202
208
|
exports.default = Webhook;
|
|
203
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
209
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiV2ViaG9vay5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9zdHJ1Y3R1cmVzL1dlYmhvb2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLGtEQUEwQjtBQU8xQiw0Q0FBd0M7QUFDeEMsdURBQXlDO0FBYXpDLE1BQXFCLE9BQVEsU0FBUSxjQUFJO0lBQ3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UFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLE1BQU0sQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLEVBQUUsRUFBRSxJQUFJLENBQUMsV0FBVyxFQUFFLElBQUksQ0FBQyxFQUFFLE1BQU0sRUFBRSxJQUFJLENBQUMsQ0FBQztJQUMzSSxDQUFDO0lBRVEsTUFBTTtRQUNYLE9BQU87WUFDSCxHQUFHLEtBQUssQ0FBQyxNQUFNLEVBQUU7WUFDakIsYUFBYSxFQUFFLElBQUksQ0FBQyxXQUFXLEVBQUUsRUFBRSxJQUFJLElBQUk7WUFDM0MsTUFBTSxFQUFTLElBQUksQ0FBQyxNQUFNO1lBQzFCLFNBQVMsRUFBTSxJQUFJLENBQUMsU0FBUyxJQUFJLElBQUk7WUFDckMsT0FBTyxFQUFRLElBQUksQ0FBQyxPQUFPO1lBQzNCLElBQUksRUFBVyxJQUFJLENBQUMsSUFBSTtZQUN4QixhQUFhLEVBQUUsSUFBSSxDQUFDLGFBQWE7WUFDakMsV0FBVyxFQUFJLElBQUksQ0FBQyxXQUFXO1lBQy9CLEtBQUssRUFBVSxJQUFJLENBQUMsS0FBSztZQUN6QixJQUFJLEVBQVcsSUFBSSxDQUFDLElBQUk7WUFDeEIsSUFBSSxFQUFXLElBQUksQ0FBQyxJQUFJLEVBQUUsTUFBTSxFQUFFO1NBQ3JDLENBQUM7SUFDTixDQUFDO0NBQ0o7QUFsTkQsMEJBa05DIn0=
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ExclusifyUnion } from "./shared";
|
|
2
2
|
import type { ApplicationCommandOptionTypes, ApplicationCommandPermissionTypes, ApplicationCommandTypes, GuildChannelTypes } from "../Constants";
|
|
3
3
|
import type ApplicationCommand from "../structures/ApplicationCommand";
|
|
4
4
|
import type ClientApplication from "../structures/ClientApplication";
|
|
@@ -194,7 +194,8 @@ export interface RESTGuildApplicationCommandPermissions {
|
|
|
194
194
|
permissions: Array<ApplicationCommandPermission>;
|
|
195
195
|
}
|
|
196
196
|
export interface GuildApplicationCommandPermissions {
|
|
197
|
-
application
|
|
197
|
+
application?: ClientApplication;
|
|
198
|
+
applicationID: string;
|
|
198
199
|
id: string;
|
|
199
200
|
permissions: Array<ApplicationCommandPermission>;
|
|
200
201
|
}
|
|
@@ -858,5 +858,5 @@ export interface ForumEmoji {
|
|
|
858
858
|
name: string | null;
|
|
859
859
|
}
|
|
860
860
|
|
|
861
|
-
export type PossiblyUncachedMessage = Message | { channel: AnyTextChannel | Uncached;
|
|
861
|
+
export type PossiblyUncachedMessage = Message | { channel: AnyTextChannel | Uncached; } & Uncached;
|
|
862
862
|
export type PossiblyUncachedThread = AnyThreadChannel | Pick<AnyThreadChannel, "id" | "type"> & { parentID: string; };
|
|
@@ -68,7 +68,7 @@ export interface RESTOptions {
|
|
|
68
68
|
requestTimeout?: number;
|
|
69
69
|
/**
|
|
70
70
|
* The `User-Agent` header to use for requests.
|
|
71
|
-
* @defaultValue Oceanic/\{VERSION\} (https://github.com/
|
|
71
|
+
* @defaultValue Oceanic/\{VERSION\} (https://github.com/OceanicJS/Oceanic)
|
|
72
72
|
*/
|
|
73
73
|
userAgent?: string;
|
|
74
74
|
}
|
|
@@ -59,9 +59,9 @@ import type StageInstance from "../structures/StageInstance";
|
|
|
59
59
|
|
|
60
60
|
export interface ClientEvents {
|
|
61
61
|
/** @event Emitted when an application command's permissions are updated. */
|
|
62
|
-
applicationCommandPermissionsUpdate: [guild: Guild, permissions: GuildApplicationCommandPermissions];
|
|
62
|
+
applicationCommandPermissionsUpdate: [guild: Guild | Uncached, permissions: GuildApplicationCommandPermissions];
|
|
63
63
|
/** @event Emitted when an auto moderation action is executed. Requires the `AUTO_MODERATION_EXECUTION` intent. */
|
|
64
|
-
autoModerationActionExecution: [guild: Guild, channel: AnyGuildTextChannel | Uncached | null, user: User | Uncached, executionOptions: AutoModerationActionExecution];
|
|
64
|
+
autoModerationActionExecution: [guild: Guild | Uncached, channel: AnyGuildTextChannel | Uncached | null, user: User | Uncached, executionOptions: AutoModerationActionExecution];
|
|
65
65
|
/** @event Emitted when an auto moderation rule is created. Requires the `AUTO_MODERATION_CONFIGURATION` intent. */
|
|
66
66
|
autoModerationRuleCreate: [rule: AutoModerationRule];
|
|
67
67
|
/** @event Emitted when an auto moderation rule is deleted. Requires the `AUTO_MODERATION_CONFIGURATION` intent. */
|
|
@@ -73,7 +73,7 @@ export interface ClientEvents {
|
|
|
73
73
|
/** @event Emitted when channel is deleted. Requires the `GUILDS` intent. */
|
|
74
74
|
channelDelete: [channel: AnyGuildChannelWithoutThreads];
|
|
75
75
|
/** @event Emitted when a channel's pins are updated (message pinned, message unpinned). Requires the `GUILDS` intent for guild channels, and `DIRECT_MESSAGES` for direct messages. */
|
|
76
|
-
channelPinsUpdate: [channel: AnyTextChannel, timestamp: Date | null];
|
|
76
|
+
channelPinsUpdate: [channel: AnyTextChannel | Uncached, timestamp: Date | null];
|
|
77
77
|
/** @event Emitted when a channel is updated. Requires the `GUILDS` intent. */
|
|
78
78
|
channelUpdate: [channel: TextChannel, oldChannel: JSONTextChannel | null] | [channel: VoiceChannel, oldChannel: JSONVoiceChannel | null] | [channel: CategoryChannel, oldChannel: JSONCategoryChannel | null] | [channel: AnnouncementChannel, oldChannel: JSONAnnouncementChannel | null] | [channel: StageChannel, oldChannel: JSONStageChannel | null];
|
|
79
79
|
/** @event Emitted when a shard connects. */
|
|
@@ -84,24 +84,24 @@ export interface ClientEvents {
|
|
|
84
84
|
disconnect: [];
|
|
85
85
|
/** @event Emitted when an error happens. */
|
|
86
86
|
error: [info: Error | string, shard?: number];
|
|
87
|
-
/** @event
|
|
87
|
+
/** @event Emitted when a guild becoms available. Requires the `GUILDS` intent. */
|
|
88
88
|
guildAvailable: [guild: Guild];
|
|
89
89
|
/** @event Emitted when a guild ban is created. Requires the `GUILD_BANS` intent. */
|
|
90
|
-
guildBanAdd: [guild: Guild, user: User];
|
|
90
|
+
guildBanAdd: [guild: Guild | Uncached, user: User];
|
|
91
91
|
/** @event Emitted when a guild ban is revoked. Requires the `GUILD_BANS` intent. */
|
|
92
|
-
guildBanRemove: [guild: Guild, user: User];
|
|
92
|
+
guildBanRemove: [guild: Guild | Uncached, user: User];
|
|
93
93
|
/** @event Emitted when the client joins a new guild. Requires the `GUILDS` intent. */
|
|
94
94
|
guildCreate: [guild: Guild];
|
|
95
95
|
/** @event Emitted when the client leaves a guild. Requires the `GUILDS` intent. */
|
|
96
96
|
guildDelete: [guild: Guild | Uncached];
|
|
97
97
|
/** @event Emitted when a guild's emojis are updated. Requires the `GUILD_EMOJIS_AND_STICKERS` intent. */
|
|
98
|
-
guildEmojisUpdate: [guild: Guild, emojis: Array<GuildEmoji>, oldEmojis: Array<GuildEmoji>];
|
|
98
|
+
guildEmojisUpdate: [guild: Guild | Uncached, emojis: Array<GuildEmoji>, oldEmojis: Array<GuildEmoji> | null];
|
|
99
99
|
/** @event Emitted when a guild's integrations are updated. Requires the `GUILD_INTEGRATOPMS` intent. */
|
|
100
|
-
guildIntegrationsUpdate: [guild: Guild];
|
|
100
|
+
guildIntegrationsUpdate: [guild: Guild | Uncached];
|
|
101
101
|
/** @event Emitted when a member joins a guild. Requires the `GUILD_MEMBERS` intent. */
|
|
102
102
|
guildMemberAdd: [member: Member];
|
|
103
103
|
/** @event Emitted when a chunk of guild members is received from Discord. */
|
|
104
|
-
guildMemberChunk: [
|
|
104
|
+
guildMemberChunk: [members: Array<Member>];
|
|
105
105
|
/** @event Emitted when a member leaves a guild. Requires the `GUILD_MEMBERS` intent. If the member is uncached, the first parameter will be a user. If the guild is uncached, the first parameter will be a user, and the second will be an object with only an `id`. */
|
|
106
106
|
guildMemberRemove: [member: Member | User, guild: Guild | Uncached];
|
|
107
107
|
/** @event Emitted when a guild member is updates. Requires the `GUILD_MEMBERS` intent.*/
|
|
@@ -123,7 +123,7 @@ export interface ClientEvents {
|
|
|
123
123
|
/** @event Emitted when a user unsubscribes from a scheduled event. Requires the `GUILD_SCHEDULED_EVENTS` intent. */
|
|
124
124
|
guildScheduledEventUserRemove: [event: GuildScheduledEvent | Uncached, user: User | Uncached];
|
|
125
125
|
/** @event Emitted when a guild's stickers are updated. Requires the `GUILD_EMOJIS_AND_STICKERS` intent. */
|
|
126
|
-
guildStickersUpdate: [guild: Guild, stickers: Array<Sticker>, oldStickers: Array<Sticker>];
|
|
126
|
+
guildStickersUpdate: [guild: Guild | Uncached, stickers: Array<Sticker>, oldStickers: Array<Sticker> | null];
|
|
127
127
|
/** @event Emitted when a guild becomes unavailable. Requires the `GUILDS` intent. */
|
|
128
128
|
guildUnavailable: [guild: UnavailableGuild];
|
|
129
129
|
/** @event Emitted when a guild is updated. Requires the `GUILDS` intent. */
|
|
@@ -131,17 +131,17 @@ export interface ClientEvents {
|
|
|
131
131
|
/** @event Emitted when a shard receives the HELLO packet. */
|
|
132
132
|
hello: [interval: number, shard: number];
|
|
133
133
|
/** @event Emitted when an integration is created. Requires the `GUILD_INTEGRATIONS` intent. */
|
|
134
|
-
integrationCreate: [guild: Guild, integration: Integration];
|
|
134
|
+
integrationCreate: [guild: Guild | Uncached, integration: Integration];
|
|
135
135
|
/** @event Emitted when an integration is deleted. Requires the `GUILD_INTEGRATIONS` intent. */
|
|
136
|
-
integrationDelete: [guild: Guild, integration: Integration | { applicationID?: string; id: string; }];
|
|
136
|
+
integrationDelete: [guild: Guild | Uncached, integration: Integration | { applicationID?: string; id: string; }];
|
|
137
137
|
/** @event Emitted when an integration is updated. Requires the `GUILD_INTEGRATIONS` intent. */
|
|
138
|
-
integrationUpdate: [guild: Guild, integration: Integration, oldIntegration: JSONIntegration | null];
|
|
138
|
+
integrationUpdate: [guild: Guild | Uncached, integration: Integration, oldIntegration: JSONIntegration | null];
|
|
139
139
|
/** @event Emitted when an interaction is created. */
|
|
140
140
|
interactionCreate: [interaction: AnyInteractionGateway];
|
|
141
141
|
/** @event Emitted when an invite is created. Requires the `GUILD_INVITES` intent. */
|
|
142
|
-
inviteCreate: [guild: Guild | null, channel: InviteChannel, invite: Invite];
|
|
142
|
+
inviteCreate: [guild: Guild | Uncached | null, channel: InviteChannel | Uncached, invite: Invite];
|
|
143
143
|
/** @event Emitted when an invite is deleted. Requires the `GUILD_INVITES` intent. */
|
|
144
|
-
inviteDelete: [guild: Guild | null, channel: InviteChannel, code: string];
|
|
144
|
+
inviteDelete: [guild: Guild | Uncached | null, channel: InviteChannel | Uncached, code: string];
|
|
145
145
|
/** @event Emitted when a message is created. Requires the `GUILD_MESSAGES` intent for guild messages, `DIRECT_MESSAGES` for direct messages. The `MESSAGE_CONTENT` intent is required for `content`, `embeds`, and similar to be present on most messages. */
|
|
146
146
|
messageCreate: [message: Message];
|
|
147
147
|
/** @event Emitted when a message is created. Requires the `GUILD_MESSAGES` intent for guild messages, `DIRECT_MESSAGES` for direct messages. The `MESSAGE_CONTENT` intent is required for `content`, `embeds`, and similar to be present on most messages. */
|
|
@@ -161,7 +161,7 @@ export interface ClientEvents {
|
|
|
161
161
|
/** @event Emitted when a raw dispatch packet is received. */
|
|
162
162
|
packet: [data: AnyDispatchPacket, shard: number];
|
|
163
163
|
/** @event Emitted when a guild member's presence, or user is updated. Requires the `GUILD_PRESENCES` intent. */
|
|
164
|
-
presenceUpdate: [guild: Guild, member: Member, presence: Presence, oldPresence: Presence | null];
|
|
164
|
+
presenceUpdate: [guild: Guild | Uncached, member: Member | Uncached, presence: Presence, oldPresence: Presence | null];
|
|
165
165
|
/** @event Emitted when all shards are ready. */
|
|
166
166
|
ready: [];
|
|
167
167
|
/** @event Emitted when a request is made. */
|
|
@@ -187,9 +187,9 @@ export interface ClientEvents {
|
|
|
187
187
|
/** @event Emitted when a guild's threads are synced. Requires the `GUILDS` intent. */
|
|
188
188
|
threadListSync: [threads: Array<AnyThreadChannel>, members: Array<ThreadMember>];
|
|
189
189
|
/** @event Emitted when a thread member is updated. Requires the `GUILDS` intent. */
|
|
190
|
-
threadMemberUpdate: [thread: AnyThreadChannel, member: ThreadMember, oldMember: ThreadMember | null];
|
|
190
|
+
threadMemberUpdate: [thread: AnyThreadChannel | Uncached, member: ThreadMember, oldMember: ThreadMember | null];
|
|
191
191
|
/** @event Emitted when the members of a thread are updated. Requires the `GUILDS` intent. The received information will be different if `GUILD_MEMBERS` is also used. */
|
|
192
|
-
threadMembersUpdate: [thread: AnyThreadChannel, addedMembers: Array<ThreadMember>, removedMembers: Array<ThreadMember>];
|
|
192
|
+
threadMembersUpdate: [thread: AnyThreadChannel | Uncached, addedMembers: Array<ThreadMember>, removedMembers: Array<ThreadMember | Uncached>];
|
|
193
193
|
/** @event Emitted when a thread is updated. Requires the `GUILDS` intent. */
|
|
194
194
|
threadUpdate: [thread: AnnouncementThreadChannel, oldThread: JSONAnnouncementThreadChannel] | [thread: PublicThreadChannel, oldThread: JSONPublicThreadChannel | null] | [thread: PrivateThreadChannel | null, oldThread: JSONPrivateThreadChannel | null];
|
|
195
195
|
/** @event Emitted when a user starts typing. Requires the `GUILD_MESSAGE_TYPING` for guilds, and `DIRECT_MESSAGE_TYPING` for direct messages. */
|
|
@@ -199,17 +199,17 @@ export interface ClientEvents {
|
|
|
199
199
|
/** @event Emitted when a user is updated. */
|
|
200
200
|
userUpdate: [user: User, oldUser: JSONUser | null];
|
|
201
201
|
/** @event Emitted when a user joins a voice channel. Requires the `GUILD_VOICE_STATES` intent. */
|
|
202
|
-
voiceChannelJoin: [member: Member, channel: VoiceChannel | StageChannel];
|
|
202
|
+
voiceChannelJoin: [member: Member, channel: VoiceChannel | StageChannel | Uncached];
|
|
203
203
|
/** @event Emitted when a user leaves a voice channel. Requires the `GUILD_VOICE_STATES` intent. */
|
|
204
|
-
voiceChannelLeave: [member: Member, channel: VoiceChannel | StageChannel];
|
|
204
|
+
voiceChannelLeave: [member: Member, channel: VoiceChannel | StageChannel | Uncached];
|
|
205
205
|
/** @event Emitted when a user switches voice channels. Requires the `GUILD_VOICE_STATES` intent. */
|
|
206
|
-
voiceChannelSwitch: [member: Member, channel: VoiceChannel | StageChannel, oldChannel: VoiceChannel | StageChannel | null];
|
|
206
|
+
voiceChannelSwitch: [member: Member, channel: VoiceChannel | StageChannel | Uncached, oldChannel: VoiceChannel | StageChannel | Uncached | null];
|
|
207
207
|
/** @event Emitted when a user's voice state is updated. Requires the `GUILD_VOICE_STATES` intent. */
|
|
208
208
|
voiceStateUpdate: [member: Member, oldState: JSONVoiceState | null];
|
|
209
209
|
/** @event Emitted with various warning information. */
|
|
210
210
|
warn: [info: string, shard?: number];
|
|
211
211
|
/** @event Emitted when a guild's webhooks are updated. Requires the `GUILD_WEBHOOKS` intent. */
|
|
212
|
-
webhooksUpdate: [guild: Guild, channel: AnyGuildChannelWithoutThreads | Uncached];
|
|
212
|
+
webhooksUpdate: [guild: Guild | Uncached, channel: AnyGuildChannelWithoutThreads | Uncached];
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
export interface ShardEvents {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { RawUser } from "./users";
|
|
2
2
|
import type { AutoModerationAction, RawAutoModerationAction } from "./auto-moderation";
|
|
3
|
-
import type { Uncached } from "./shared";
|
|
4
3
|
import type { ActivityTypes, AutoModerationTriggerTypes, IntentNames } from "../Constants";
|
|
5
4
|
import type AutoModerationRule from "../structures/AutoModerationRule";
|
|
6
5
|
import type { ClientOptions as WSClientOptions } from "ws";
|
|
@@ -264,7 +263,8 @@ export interface AutoModerationActionExecution {
|
|
|
264
263
|
matchedContent: string;
|
|
265
264
|
matchedKeyword: string | null;
|
|
266
265
|
messageID?: string;
|
|
267
|
-
rule
|
|
266
|
+
rule?: AutoModerationRule;
|
|
267
|
+
ruleID: string;
|
|
268
268
|
ruleTriggerType: AutoModerationTriggerTypes;
|
|
269
269
|
}
|
|
270
270
|
|