seyfert 2.1.1-dev-12246048689.0 → 2.1.1-dev-12261178806.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cache/index.d.ts +1 -1
- package/lib/cache/index.js +4 -4
- package/lib/client/base.d.ts +3 -4
- package/lib/client/base.js +6 -9
- package/lib/client/client.d.ts +1 -1
- package/lib/client/client.js +12 -12
- package/lib/client/transformers.d.ts +5 -5
- package/lib/client/workerclient.d.ts +1 -1
- package/lib/client/workerclient.js +13 -13
- package/lib/commands/applications/chatcontext.js +1 -1
- package/lib/commands/applications/entrycontext.d.ts +1 -1
- package/lib/commands/applications/menucontext.d.ts +1 -1
- package/lib/commands/handle.js +5 -5
- package/lib/common/it/utils.d.ts +1 -0
- package/lib/common/it/utils.js +6 -0
- package/lib/common/shorters/bans.js +2 -2
- package/lib/common/shorters/interaction.d.ts +2 -2
- package/lib/common/shorters/interaction.js +1 -1
- package/lib/common/shorters/members.js +1 -1
- package/lib/common/shorters/messages.js +1 -1
- package/lib/components/componentcontext.d.ts +1 -1
- package/lib/components/modalcontext.d.ts +1 -1
- package/lib/components/modalcontext.js +1 -1
- package/lib/events/handler.js +5 -5
- package/lib/events/hooks/thread.d.ts +55 -55
- package/lib/structures/Interaction.d.ts +2 -2
- package/lib/structures/Interaction.js +1 -1
- package/lib/structures/channels.d.ts +12 -12
- package/lib/structures/channels.js +13 -13
- package/lib/types/utils/index.d.ts +3 -5
- package/lib/types/utils/index.js +2 -4
- package/package.json +1 -1
package/lib/cache/index.d.ts
CHANGED
|
@@ -16,8 +16,8 @@ import { type GatewayDispatchPayload, GatewayIntentBits } from '../types';
|
|
|
16
16
|
import { Messages } from './resources/messages';
|
|
17
17
|
import { Overwrites } from './resources/overwrites';
|
|
18
18
|
export { BaseResource } from './resources/default/base';
|
|
19
|
-
export { GuildRelatedResource } from './resources/default/guild-related';
|
|
20
19
|
export { GuildBasedResource } from './resources/default/guild-based';
|
|
20
|
+
export { GuildRelatedResource } from './resources/default/guild-related';
|
|
21
21
|
export type InferAsyncCache = InternalOptions extends {
|
|
22
22
|
asyncCache: infer P;
|
|
23
23
|
} ? P : false;
|
package/lib/cache/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Cache = exports.
|
|
17
|
+
exports.Cache = exports.GuildRelatedResource = exports.GuildBasedResource = exports.BaseResource = void 0;
|
|
18
18
|
const common_1 = require("../common");
|
|
19
19
|
const guilds_1 = require("./resources/guilds");
|
|
20
20
|
const users_1 = require("./resources/users");
|
|
@@ -32,10 +32,10 @@ const messages_1 = require("./resources/messages");
|
|
|
32
32
|
const overwrites_1 = require("./resources/overwrites");
|
|
33
33
|
var base_1 = require("./resources/default/base");
|
|
34
34
|
Object.defineProperty(exports, "BaseResource", { enumerable: true, get: function () { return base_1.BaseResource; } });
|
|
35
|
-
var guild_related_1 = require("./resources/default/guild-related");
|
|
36
|
-
Object.defineProperty(exports, "GuildRelatedResource", { enumerable: true, get: function () { return guild_related_1.GuildRelatedResource; } });
|
|
37
35
|
var guild_based_1 = require("./resources/default/guild-based");
|
|
38
36
|
Object.defineProperty(exports, "GuildBasedResource", { enumerable: true, get: function () { return guild_based_1.GuildBasedResource; } });
|
|
37
|
+
var guild_related_1 = require("./resources/default/guild-related");
|
|
38
|
+
Object.defineProperty(exports, "GuildRelatedResource", { enumerable: true, get: function () { return guild_related_1.GuildRelatedResource; } });
|
|
39
39
|
__exportStar(require("./adapters/index"), exports);
|
|
40
40
|
class Cache {
|
|
41
41
|
intents;
|
|
@@ -117,7 +117,7 @@ class Cache {
|
|
|
117
117
|
return this.hasIntent('DirectMessages');
|
|
118
118
|
}
|
|
119
119
|
get hasBansIntent() {
|
|
120
|
-
return this.hasIntent('
|
|
120
|
+
return this.hasIntent('GuildModeration');
|
|
121
121
|
}
|
|
122
122
|
async bulkGet(keys) {
|
|
123
123
|
const allData = {};
|
package/lib/client/base.d.ts
CHANGED
|
@@ -37,14 +37,13 @@ export declare class BaseClient {
|
|
|
37
37
|
soundboards: SoundboardShorter;
|
|
38
38
|
debugger?: Logger;
|
|
39
39
|
logger: Logger;
|
|
40
|
-
langs
|
|
41
|
-
commands
|
|
42
|
-
components
|
|
40
|
+
langs: LangsHandler;
|
|
41
|
+
commands: CommandHandler;
|
|
42
|
+
components: ComponentHandler;
|
|
43
43
|
handleCommand: HandleCommand;
|
|
44
44
|
private _applicationId?;
|
|
45
45
|
private _botId?;
|
|
46
46
|
middlewares?: Record<string, MiddlewareContext>;
|
|
47
|
-
protected static assertString(value: unknown, message?: string): asserts value is string;
|
|
48
47
|
protected static getBotIdFromToken(token: string): string;
|
|
49
48
|
options: BaseClientOptions;
|
|
50
49
|
constructor(options?: BaseClientOptions);
|
package/lib/client/base.js
CHANGED
|
@@ -45,11 +45,6 @@ class BaseClient {
|
|
|
45
45
|
_applicationId;
|
|
46
46
|
_botId;
|
|
47
47
|
middlewares;
|
|
48
|
-
static assertString(value, message) {
|
|
49
|
-
if (!(typeof value === 'string' && value !== '')) {
|
|
50
|
-
throw new Error(message ?? 'Value is not a string');
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
48
|
static getBotIdFromToken(token) {
|
|
54
49
|
return Buffer.from(token.split('.')[0], 'base64').toString('ascii');
|
|
55
50
|
}
|
|
@@ -191,7 +186,7 @@ class BaseClient {
|
|
|
191
186
|
await this.loadComponents(options.componentsDir);
|
|
192
187
|
const { token: tokenRC, debug } = await this.getRC();
|
|
193
188
|
const token = options.token ?? tokenRC;
|
|
194
|
-
|
|
189
|
+
(0, common_1.assertString)(token, 'token is not a string');
|
|
195
190
|
if (this.rest.options.token === 'INVALID')
|
|
196
191
|
this.rest.options.token = token;
|
|
197
192
|
this.rest.debug = debug;
|
|
@@ -248,14 +243,16 @@ class BaseClient {
|
|
|
248
243
|
return should;
|
|
249
244
|
}
|
|
250
245
|
syncCachePath(cachePath) {
|
|
251
|
-
return node_fs_1.promises.writeFile(cachePath, JSON.stringify(this.commands.values
|
|
246
|
+
return node_fs_1.promises.writeFile(cachePath, JSON.stringify(this.commands.values
|
|
247
|
+
.filter(cmd => !('ignore' in cmd) || cmd.ignore !== shared_1.IgnoreCommand.Slash)
|
|
248
|
+
.map(x => x.toJSON())));
|
|
252
249
|
}
|
|
253
250
|
async uploadCommands({ applicationId, cachePath } = {}) {
|
|
254
251
|
applicationId ??= await this.getRC().then(x => x.applicationId ?? this.applicationId);
|
|
255
|
-
|
|
252
|
+
(0, common_1.assertString)(applicationId, 'applicationId is not a string');
|
|
256
253
|
const commands = this.commands.values;
|
|
257
254
|
const filter = (0, common_1.filterSplit)(commands, command => ('guildId' in command ? !command.guildId : true));
|
|
258
|
-
if (this.commands
|
|
255
|
+
if (this.commands.entryPoint) {
|
|
259
256
|
filter.expect.push(this.commands.entryPoint);
|
|
260
257
|
}
|
|
261
258
|
if (!cachePath || (await this.shouldUploadCommands(cachePath)))
|
package/lib/client/client.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare class Client<Ready extends boolean = boolean> extends BaseClient
|
|
|
19
19
|
memberUpdateHandler: MemberUpdateHandler;
|
|
20
20
|
presenceUpdateHandler: PresenceUpdateHandler;
|
|
21
21
|
collectors: Collectors;
|
|
22
|
-
events
|
|
22
|
+
events: EventHandler;
|
|
23
23
|
constructor(options?: ClientOptions);
|
|
24
24
|
setServices({ gateway, ...rest }: ServicesOptions & {
|
|
25
25
|
gateway?: ShardManager;
|
package/lib/client/client.js
CHANGED
|
@@ -35,7 +35,7 @@ class Client extends base_1.BaseClient {
|
|
|
35
35
|
}
|
|
36
36
|
async loadEvents(dir) {
|
|
37
37
|
dir ??= await this.getRC().then(x => ('events' in x.locations ? x.locations.events : undefined));
|
|
38
|
-
if (dir
|
|
38
|
+
if (dir) {
|
|
39
39
|
await this.events.load(dir);
|
|
40
40
|
this.logger.info('EventHandler loaded');
|
|
41
41
|
}
|
|
@@ -70,7 +70,7 @@ class Client extends base_1.BaseClient {
|
|
|
70
70
|
const intents = options?.connection?.intents ?? intentsRC;
|
|
71
71
|
this.cache.intents = intents;
|
|
72
72
|
if (!this.gateway) {
|
|
73
|
-
|
|
73
|
+
(0, common_1.assertString)(token, 'token is not a string');
|
|
74
74
|
this.gateway = new websocket_1.ShardManager({
|
|
75
75
|
token,
|
|
76
76
|
info: await this.proxy.gateway.bot.get(),
|
|
@@ -105,7 +105,7 @@ class Client extends base_1.BaseClient {
|
|
|
105
105
|
}
|
|
106
106
|
async onPacket(shardId, packet) {
|
|
107
107
|
Promise.allSettled([
|
|
108
|
-
this.events
|
|
108
|
+
this.events.runEvent('RAW', this, packet, shardId, false),
|
|
109
109
|
this.collectors.run('RAW', packet, this),
|
|
110
110
|
]); //ignore promise
|
|
111
111
|
switch (packet.t) {
|
|
@@ -114,7 +114,7 @@ class Client extends base_1.BaseClient {
|
|
|
114
114
|
if (!this.memberUpdateHandler.check(packet.d)) {
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
|
-
await this.events
|
|
117
|
+
await this.events.execute(packet, this, shardId);
|
|
118
118
|
}
|
|
119
119
|
break;
|
|
120
120
|
case 'PRESENCE_UPDATE':
|
|
@@ -122,7 +122,7 @@ class Client extends base_1.BaseClient {
|
|
|
122
122
|
if (!this.presenceUpdateHandler.check(packet.d)) {
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
await this.events
|
|
125
|
+
await this.events.execute(packet, this, shardId);
|
|
126
126
|
}
|
|
127
127
|
break;
|
|
128
128
|
case 'GUILD_DELETE':
|
|
@@ -132,13 +132,13 @@ class Client extends base_1.BaseClient {
|
|
|
132
132
|
if (!this.__handleGuilds?.length && [...this.gateway.values()].every(shard => shard.data.session_id)) {
|
|
133
133
|
delete this.__handleGuilds;
|
|
134
134
|
await this.cache.onPacket(packet);
|
|
135
|
-
return this.events
|
|
135
|
+
return this.events.runEvent('BOT_READY', this, this.me, -1);
|
|
136
136
|
}
|
|
137
137
|
if (!this.__handleGuilds?.length)
|
|
138
138
|
delete this.__handleGuilds;
|
|
139
139
|
return this.cache.onPacket(packet);
|
|
140
140
|
}
|
|
141
|
-
await this.events
|
|
141
|
+
await this.events.execute(packet, this, shardId);
|
|
142
142
|
break;
|
|
143
143
|
}
|
|
144
144
|
//rest of the events
|
|
@@ -146,13 +146,13 @@ class Client extends base_1.BaseClient {
|
|
|
146
146
|
switch (packet.t) {
|
|
147
147
|
case 'INTERACTION_CREATE':
|
|
148
148
|
{
|
|
149
|
-
await this.events
|
|
149
|
+
await this.events.execute(packet, this, shardId);
|
|
150
150
|
await this.handleCommand.interaction(packet.d, shardId);
|
|
151
151
|
}
|
|
152
152
|
break;
|
|
153
153
|
case 'MESSAGE_CREATE':
|
|
154
154
|
{
|
|
155
|
-
await this.events
|
|
155
|
+
await this.events.execute(packet, this, shardId);
|
|
156
156
|
await this.handleCommand.message(packet.d, shardId);
|
|
157
157
|
}
|
|
158
158
|
break;
|
|
@@ -166,16 +166,16 @@ class Client extends base_1.BaseClient {
|
|
|
166
166
|
this.me = transformers_1.Transformers.ClientUser(this, packet.d.user, packet.d.application);
|
|
167
167
|
if (!this.__handleGuilds?.length) {
|
|
168
168
|
if ([...this.gateway.values()].every(shard => shard.data.session_id)) {
|
|
169
|
-
await this.events
|
|
169
|
+
await this.events.runEvent('BOT_READY', this, this.me, -1);
|
|
170
170
|
}
|
|
171
171
|
delete this.__handleGuilds;
|
|
172
172
|
}
|
|
173
173
|
this.debugger?.debug(`#${shardId}[${packet.d.user.username}](${this.botId}) is online...`);
|
|
174
|
-
await this.events
|
|
174
|
+
await this.events.execute(packet, this, shardId);
|
|
175
175
|
break;
|
|
176
176
|
}
|
|
177
177
|
default:
|
|
178
|
-
await this.events
|
|
178
|
+
await this.events.execute(packet, this, shardId);
|
|
179
179
|
break;
|
|
180
180
|
}
|
|
181
181
|
break;
|
|
@@ -40,13 +40,13 @@ export declare const Transformers: {
|
|
|
40
40
|
BaseGuildChannel(client: import("../commands").UsingClient, data: import("../types").APIGuildChannel<ChannelType>): BaseGuildChannelStructure;
|
|
41
41
|
TextGuildChannel(client: import("../commands").UsingClient, data: import("../types").APIGuildChannel<ChannelType>): TextGuildChannelStructure;
|
|
42
42
|
DMChannel(client: import("../commands").UsingClient, data: import("../types").APIChannelBase<ChannelType>): DMChannelStructure;
|
|
43
|
-
VoiceChannel(client: import("../commands").UsingClient, data: import("../types").
|
|
44
|
-
StageChannel(client: import("../commands").UsingClient, data: import("../types").
|
|
45
|
-
MediaChannel(client: import("../commands").UsingClient, data: import("../types").
|
|
46
|
-
ForumChannel(client: import("../commands").UsingClient, data: import("../types").
|
|
43
|
+
VoiceChannel(client: import("../commands").UsingClient, data: import("../types").APIGuildChannel<ChannelType>): VoiceChannelStructure;
|
|
44
|
+
StageChannel(client: import("../commands").UsingClient, data: import("../types").APIGuildChannel<ChannelType>): StageChannelStructure;
|
|
45
|
+
MediaChannel(client: import("../commands").UsingClient, data: import("../types").APIGuildChannel<ChannelType>): MediaChannelStructure;
|
|
46
|
+
ForumChannel(client: import("../commands").UsingClient, data: import("../types").APIGuildChannel<ChannelType>): ForumChannelStructure;
|
|
47
47
|
ThreadChannel(client: import("../commands").UsingClient, data: import("../types").APIChannelBase<ChannelType>): ThreadChannelStructure;
|
|
48
48
|
CategoryChannel(...args: ConstructorParameters<typeof CategoryChannel>): CategoryChannelStructure;
|
|
49
|
-
NewsChannel(client: import("../commands").UsingClient, data: import("../types").
|
|
49
|
+
NewsChannel(client: import("../commands").UsingClient, data: import("../types").APIGuildChannel<ChannelType>): NewsChannelStructure;
|
|
50
50
|
DirectoryChannel(client: import("../commands").UsingClient, data: import("../types").APIChannelBase<ChannelType>): DirectoryChannelStructure;
|
|
51
51
|
ClientUser(client: import("../commands").UsingClient, data: import("../types").APIUser, application: Pick<import("../types").APIApplication, "id" | "flags">): ClientUserStructure;
|
|
52
52
|
Guild<State extends StructStates = "api">(client: import("../commands").UsingClient, data: import("../types").APIGuild | import("../types").GatewayGuildCreateDispatchData): GuildStructure<State>;
|
|
@@ -18,7 +18,7 @@ export declare class WorkerClient<Ready extends boolean = boolean> extends BaseC
|
|
|
18
18
|
memberUpdateHandler: MemberUpdateHandler;
|
|
19
19
|
presenceUpdateHandler: PresenceUpdateHandler;
|
|
20
20
|
collectors: Collectors;
|
|
21
|
-
events
|
|
21
|
+
events: EventHandler;
|
|
22
22
|
me: When<Ready, ClientUserStructure>;
|
|
23
23
|
promises: Map<string, {
|
|
24
24
|
resolve: (value: any) => void;
|
|
@@ -119,7 +119,7 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
119
119
|
}
|
|
120
120
|
async loadEvents(dir) {
|
|
121
121
|
dir ??= await this.getRC().then(x => ('events' in x.locations ? x.locations.events : undefined));
|
|
122
|
-
if (dir
|
|
122
|
+
if (dir) {
|
|
123
123
|
await this.events.load(dir);
|
|
124
124
|
this.logger.info('EventHandler loaded');
|
|
125
125
|
}
|
|
@@ -281,7 +281,7 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
281
281
|
}
|
|
282
282
|
break;
|
|
283
283
|
case 'BOT_READY':
|
|
284
|
-
await this.events
|
|
284
|
+
await this.events.runEvent('BOT_READY', this, this.me, -1);
|
|
285
285
|
break;
|
|
286
286
|
case 'API_RESPONSE':
|
|
287
287
|
{
|
|
@@ -440,7 +440,7 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
440
440
|
}
|
|
441
441
|
async onPacket(packet, shardId) {
|
|
442
442
|
Promise.allSettled([
|
|
443
|
-
this.events
|
|
443
|
+
this.events.runEvent('RAW', this, packet, shardId, false),
|
|
444
444
|
this.collectors.run('RAW', packet, this),
|
|
445
445
|
]); //ignore promise
|
|
446
446
|
switch (packet.t) {
|
|
@@ -449,7 +449,7 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
449
449
|
if (!this.memberUpdateHandler.check(packet.d)) {
|
|
450
450
|
return;
|
|
451
451
|
}
|
|
452
|
-
await this.events
|
|
452
|
+
await this.events.execute(packet, this, shardId);
|
|
453
453
|
}
|
|
454
454
|
break;
|
|
455
455
|
case 'PRESENCE_UPDATE':
|
|
@@ -457,7 +457,7 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
457
457
|
if (!this.presenceUpdateHandler.check(packet.d)) {
|
|
458
458
|
return;
|
|
459
459
|
}
|
|
460
|
-
await this.events
|
|
460
|
+
await this.events.execute(packet, this, shardId);
|
|
461
461
|
}
|
|
462
462
|
break;
|
|
463
463
|
case 'GUILD_DELETE':
|
|
@@ -471,26 +471,26 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
471
471
|
type: 'WORKER_READY',
|
|
472
472
|
workerId: this.workerId,
|
|
473
473
|
});
|
|
474
|
-
return this.events
|
|
474
|
+
return this.events.runEvent('WORKER_READY', this, this.me, -1);
|
|
475
475
|
}
|
|
476
476
|
if (!this.__handleGuilds?.length)
|
|
477
477
|
delete this.__handleGuilds;
|
|
478
478
|
return this.cache.onPacket(packet);
|
|
479
479
|
}
|
|
480
|
-
await this.events
|
|
480
|
+
await this.events.execute(packet, this, shardId);
|
|
481
481
|
break;
|
|
482
482
|
}
|
|
483
483
|
default: {
|
|
484
484
|
switch (packet.t) {
|
|
485
485
|
case 'INTERACTION_CREATE':
|
|
486
486
|
{
|
|
487
|
-
await this.events
|
|
487
|
+
await this.events.execute(packet, this, shardId);
|
|
488
488
|
await this.handleCommand.interaction(packet.d, shardId);
|
|
489
489
|
}
|
|
490
490
|
break;
|
|
491
491
|
case 'MESSAGE_CREATE':
|
|
492
492
|
{
|
|
493
|
-
await this.events
|
|
493
|
+
await this.events.execute(packet, this, shardId);
|
|
494
494
|
await this.handleCommand.message(packet.d, shardId);
|
|
495
495
|
}
|
|
496
496
|
break;
|
|
@@ -503,14 +503,14 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
503
503
|
this.botId = packet.d.user.id;
|
|
504
504
|
this.applicationId = packet.d.application.id;
|
|
505
505
|
this.me = transformers_1.Transformers.ClientUser(this, packet.d.user, packet.d.application);
|
|
506
|
-
await this.events
|
|
506
|
+
await this.events.execute(packet, this, shardId);
|
|
507
507
|
if (!this._ready && [...this.shards.values()].every(shard => shard.data.session_id)) {
|
|
508
508
|
this._ready = true;
|
|
509
509
|
this.postMessage({
|
|
510
510
|
type: 'WORKER_SHARDS_CONNECTED',
|
|
511
511
|
workerId: this.workerId,
|
|
512
512
|
});
|
|
513
|
-
await this.events
|
|
513
|
+
await this.events.runEvent('WORKER_SHARDS_CONNECTED', this, this.me, -1);
|
|
514
514
|
}
|
|
515
515
|
if (!this.__handleGuilds?.length) {
|
|
516
516
|
if ([...this.shards.values()].every(shard => shard.data.session_id)) {
|
|
@@ -518,7 +518,7 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
518
518
|
type: 'WORKER_READY',
|
|
519
519
|
workerId: this.workerId,
|
|
520
520
|
});
|
|
521
|
-
await this.events
|
|
521
|
+
await this.events.runEvent('WORKER_READY', this, this.me, -1);
|
|
522
522
|
}
|
|
523
523
|
delete this.__handleGuilds;
|
|
524
524
|
}
|
|
@@ -526,7 +526,7 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
526
526
|
}
|
|
527
527
|
break;
|
|
528
528
|
default:
|
|
529
|
-
await this.events
|
|
529
|
+
await this.events.execute(packet, this, shardId);
|
|
530
530
|
break;
|
|
531
531
|
}
|
|
532
532
|
break;
|
|
@@ -32,7 +32,7 @@ class CommandContext extends basecontext_1.BaseContext {
|
|
|
32
32
|
return this.client.proxy;
|
|
33
33
|
}
|
|
34
34
|
get t() {
|
|
35
|
-
return this.client.t(this.interaction?.locale ?? this.client.langs
|
|
35
|
+
return this.client.t(this.interaction?.locale ?? this.client.langs.defaultLang ?? 'en-US');
|
|
36
36
|
}
|
|
37
37
|
get fullCommandName() {
|
|
38
38
|
return this.resolver.fullCommandName;
|
|
@@ -24,7 +24,7 @@ export declare class EntryPointContext<M extends keyof RegisteredMiddlewares = n
|
|
|
24
24
|
modal(body: ModalCreateBodyRequest): Promise<undefined>;
|
|
25
25
|
deferReply<WR extends boolean = false>(ephemeral?: boolean, withResponse?: WR): Promise<import("../../common").When<WR, import("../..").WebhookMessage, undefined>>;
|
|
26
26
|
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<import("../..").WebhookMessage>;
|
|
27
|
-
deleteResponse(): Promise<void
|
|
27
|
+
deleteResponse(): Promise<void>;
|
|
28
28
|
editOrReply<WR extends boolean = false>(body: InteractionCreateBodyRequest | InteractionMessageUpdateBodyRequest, withResponse?: WR): Promise<import("../../common").When<WR, import("../..").WebhookMessage, void>>;
|
|
29
29
|
fetchResponse(): Promise<import("../..").WebhookMessage>;
|
|
30
30
|
channel(mode?: 'rest' | 'flow'): Promise<AllChannels>;
|
|
@@ -25,7 +25,7 @@ export declare class MenuCommandContext<T extends MessageCommandInteraction | Us
|
|
|
25
25
|
modal(body: ModalCreateBodyRequest): Promise<undefined>;
|
|
26
26
|
deferReply<WR extends boolean = false>(ephemeral?: boolean, withResponse?: WR): Promise<import("../../common").When<WR, import("../..").WebhookMessage, undefined>>;
|
|
27
27
|
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<import("../..").WebhookMessage>;
|
|
28
|
-
deleteResponse(): Promise<void
|
|
28
|
+
deleteResponse(): Promise<void>;
|
|
29
29
|
editOrReply<WR extends boolean = false>(body: InteractionCreateBodyRequest | InteractionMessageUpdateBodyRequest, withResponse?: WR): Promise<import("../../common").When<WR, import("../..").WebhookMessage, void>>;
|
|
30
30
|
fetchResponse(): Promise<import("../..").WebhookMessage>;
|
|
31
31
|
channel(mode?: 'rest' | 'flow'): Promise<AllChannels>;
|
package/lib/commands/handle.js
CHANGED
|
@@ -148,14 +148,14 @@ class HandleCommand {
|
|
|
148
148
|
const context = new components_1.ModalContext(this.client, interaction);
|
|
149
149
|
const extended = this.client.options?.context?.(interaction) ?? {};
|
|
150
150
|
Object.assign(context, extended);
|
|
151
|
-
await this.client.components
|
|
151
|
+
await this.client.components.executeModal(context);
|
|
152
152
|
}
|
|
153
153
|
async messageComponent(interaction) {
|
|
154
154
|
//@ts-expect-error
|
|
155
155
|
const context = new components_1.ComponentContext(this.client, interaction);
|
|
156
156
|
const extended = this.client.options?.context?.(interaction) ?? {};
|
|
157
157
|
Object.assign(context, extended);
|
|
158
|
-
await this.client.components
|
|
158
|
+
await this.client.components.executeComponent(context);
|
|
159
159
|
}
|
|
160
160
|
async interaction(body, shardId, __reply) {
|
|
161
161
|
this.client.debugger?.debug(`[${types_1.InteractionType[body.type] ?? body.type}] Interaction received.`);
|
|
@@ -185,7 +185,7 @@ class HandleCommand {
|
|
|
185
185
|
break;
|
|
186
186
|
}
|
|
187
187
|
case types_1.ApplicationCommandType.PrimaryEntryPoint: {
|
|
188
|
-
const command = this.client.commands
|
|
188
|
+
const command = this.client.commands.entryPoint;
|
|
189
189
|
if (!command?.run)
|
|
190
190
|
return;
|
|
191
191
|
const interaction = structures_1.BaseInteraction.from(this.client, body, __reply);
|
|
@@ -214,7 +214,7 @@ class HandleCommand {
|
|
|
214
214
|
case types_1.InteractionType.ModalSubmit:
|
|
215
215
|
{
|
|
216
216
|
const interaction = structures_1.BaseInteraction.from(this.client, body, __reply);
|
|
217
|
-
if (this.client.components
|
|
217
|
+
if (this.client.components.hasModal(interaction)) {
|
|
218
218
|
await this.client.components.onModalSubmit(interaction);
|
|
219
219
|
}
|
|
220
220
|
else
|
|
@@ -224,7 +224,7 @@ class HandleCommand {
|
|
|
224
224
|
case types_1.InteractionType.MessageComponent:
|
|
225
225
|
{
|
|
226
226
|
const interaction = structures_1.BaseInteraction.from(this.client, body, __reply);
|
|
227
|
-
if (this.client.components
|
|
227
|
+
if (this.client.components.hasComponent(body.message.id, interaction.customId)) {
|
|
228
228
|
await this.client.components.onComponent(body.message.id, interaction);
|
|
229
229
|
}
|
|
230
230
|
else
|
package/lib/common/it/utils.d.ts
CHANGED
|
@@ -120,3 +120,4 @@ export declare function hasProps<T extends Record<any, any>>(target: T, props: T
|
|
|
120
120
|
export declare function hasIntent(intents: number, target: keyof typeof GatewayIntentBits | GatewayIntentBits): boolean;
|
|
121
121
|
export declare function toArrayBuffer(buffer: Buffer): ArrayBuffer;
|
|
122
122
|
export declare function toBuffer(arrayBuffer: ArrayBuffer): Buffer<ArrayBuffer>;
|
|
123
|
+
export declare function assertString(value: unknown, message?: string): asserts value is string;
|
package/lib/common/it/utils.js
CHANGED
|
@@ -21,6 +21,7 @@ exports.hasProps = hasProps;
|
|
|
21
21
|
exports.hasIntent = hasIntent;
|
|
22
22
|
exports.toArrayBuffer = toArrayBuffer;
|
|
23
23
|
exports.toBuffer = toBuffer;
|
|
24
|
+
exports.assertString = assertString;
|
|
24
25
|
const node_fs_1 = require("node:fs");
|
|
25
26
|
const node_path_1 = require("node:path");
|
|
26
27
|
const __1 = require("..");
|
|
@@ -385,3 +386,8 @@ function toBuffer(arrayBuffer) {
|
|
|
385
386
|
}
|
|
386
387
|
return buffer;
|
|
387
388
|
}
|
|
389
|
+
function assertString(value, message) {
|
|
390
|
+
if (!(typeof value === 'string' && value !== '')) {
|
|
391
|
+
throw new Error(message ?? 'Value is not a string');
|
|
392
|
+
}
|
|
393
|
+
}
|
|
@@ -13,7 +13,7 @@ class BanShorter extends base_1.BaseShorter {
|
|
|
13
13
|
async bulkCreate(guildId, body, reason) {
|
|
14
14
|
const bans = await this.client.proxy.guilds(guildId)['bulk-bans'].post({ reason, body });
|
|
15
15
|
for (const id of bans.banned_users)
|
|
16
|
-
this.client.cache.members?.removeIfNI('
|
|
16
|
+
this.client.cache.members?.removeIfNI('GuildModeration', id, guildId);
|
|
17
17
|
return bans;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
@@ -34,7 +34,7 @@ class BanShorter extends base_1.BaseShorter {
|
|
|
34
34
|
*/
|
|
35
35
|
async create(guildId, memberId, body, reason) {
|
|
36
36
|
await this.client.proxy.guilds(guildId).bans(memberId).put({ reason, body });
|
|
37
|
-
await this.client.cache.members?.removeIfNI('
|
|
37
|
+
await this.client.cache.members?.removeIfNI('GuildModeration', memberId, guildId);
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* Fetches a ban from the guild.
|
|
@@ -7,7 +7,7 @@ export declare class InteractionShorter extends BaseShorter {
|
|
|
7
7
|
fetchOriginal(token: string): Promise<import("../..").WebhookMessage>;
|
|
8
8
|
editMessage(token: string, messageId: string, body: InteractionMessageUpdateBodyRequest): Promise<import("../..").WebhookMessage>;
|
|
9
9
|
editOriginal(token: string, body: InteractionMessageUpdateBodyRequest): Promise<import("../..").WebhookMessage>;
|
|
10
|
-
deleteResponse(token: string, messageId: string): Promise<void
|
|
11
|
-
deleteOriginal(token: string): Promise<void
|
|
10
|
+
deleteResponse(token: string, messageId: string): Promise<void>;
|
|
11
|
+
deleteOriginal(token: string): Promise<void>;
|
|
12
12
|
followup(token: string, { files, ...body }: MessageWebhookCreateBodyRequest): Promise<import("../..").WebhookMessage>;
|
|
13
13
|
}
|
|
@@ -48,7 +48,7 @@ class InteractionShorter extends base_1.BaseShorter {
|
|
|
48
48
|
.webhooks(this.client.applicationId)(token)
|
|
49
49
|
.messages(messageId)
|
|
50
50
|
.delete()
|
|
51
|
-
.then(() => this.client.components
|
|
51
|
+
.then(() => this.client.components.deleteValue(messageId, 'messageDelete'));
|
|
52
52
|
}
|
|
53
53
|
deleteOriginal(token) {
|
|
54
54
|
return this.deleteResponse(token, '@original');
|
|
@@ -61,7 +61,7 @@ class MemberShorter extends base_1.BaseShorter {
|
|
|
61
61
|
*/
|
|
62
62
|
async ban(guildId, memberId, body, reason) {
|
|
63
63
|
await this.client.proxy.guilds(guildId).bans(memberId).put({ reason, body });
|
|
64
|
-
await this.client.cache.members?.removeIfNI('
|
|
64
|
+
await this.client.cache.members?.removeIfNI('GuildModeration', memberId, guildId);
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Kicks a member from the guild.
|
|
@@ -51,7 +51,7 @@ class MessageShorter extends base_1.BaseShorter {
|
|
|
51
51
|
.delete({ reason })
|
|
52
52
|
.then(async () => {
|
|
53
53
|
await this.client.cache.messages?.removeIfNI('GuildMessages', messageId, channelId);
|
|
54
|
-
this.client.components
|
|
54
|
+
this.client.components.deleteValue(messageId, 'messageDelete');
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
fetch(messageId, channelId) {
|
|
@@ -70,7 +70,7 @@ export declare class ComponentContext<Type extends keyof ContextComponentCommand
|
|
|
70
70
|
* Deletes the response of the interaction.
|
|
71
71
|
* @returns A promise that resolves when the response is deleted.
|
|
72
72
|
*/
|
|
73
|
-
deleteResponse(): Promise<void
|
|
73
|
+
deleteResponse(): Promise<void>;
|
|
74
74
|
modal(body: ModalCreateBodyRequest): Promise<undefined>;
|
|
75
75
|
/**
|
|
76
76
|
* Gets the channel of the interaction.
|
|
@@ -67,7 +67,7 @@ export declare class ModalContext<M extends keyof RegisteredMiddlewares = never>
|
|
|
67
67
|
* Deletes the response of the interaction.
|
|
68
68
|
* @returns A promise that resolves when the response is deleted.
|
|
69
69
|
*/
|
|
70
|
-
deleteResponse(): Promise<void
|
|
70
|
+
deleteResponse(): Promise<void>;
|
|
71
71
|
modal(body: ModalCreateBodyRequest): ReturnType<Interaction['modal']>;
|
|
72
72
|
/**
|
|
73
73
|
* Gets the channel of the interaction.
|
|
@@ -33,7 +33,7 @@ class ModalContext extends basecontext_1.BaseContext {
|
|
|
33
33
|
* Gets the language object for the interaction's locale.
|
|
34
34
|
*/
|
|
35
35
|
get t() {
|
|
36
|
-
return this.client.t(this.interaction?.locale ?? this.client.langs
|
|
36
|
+
return this.client.t(this.interaction?.locale ?? this.client.langs.defaultLang ?? 'en-US');
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Writes a response to the interaction.
|
package/lib/events/handler.js
CHANGED
|
@@ -85,7 +85,7 @@ class EventHandler extends common_1.BaseHandler {
|
|
|
85
85
|
switch (raw.t) {
|
|
86
86
|
case 'MESSAGE_DELETE':
|
|
87
87
|
{
|
|
88
|
-
if (!client.components
|
|
88
|
+
if (!client.components.values.size)
|
|
89
89
|
break;
|
|
90
90
|
const value = client.components.values.get(raw.d.id);
|
|
91
91
|
if (value) {
|
|
@@ -95,7 +95,7 @@ class EventHandler extends common_1.BaseHandler {
|
|
|
95
95
|
break;
|
|
96
96
|
case 'MESSAGE_DELETE_BULK':
|
|
97
97
|
{
|
|
98
|
-
if (!client.components
|
|
98
|
+
if (!client.components.values.size)
|
|
99
99
|
break;
|
|
100
100
|
for (const id of raw.d.ids) {
|
|
101
101
|
const value = client.components.values.get(id);
|
|
@@ -107,7 +107,7 @@ class EventHandler extends common_1.BaseHandler {
|
|
|
107
107
|
break;
|
|
108
108
|
case 'GUILD_DELETE':
|
|
109
109
|
{
|
|
110
|
-
if (!client.components
|
|
110
|
+
if (!client.components.values.size)
|
|
111
111
|
break;
|
|
112
112
|
// ignore unavailable guilds?
|
|
113
113
|
if (raw.d.unavailable)
|
|
@@ -120,7 +120,7 @@ class EventHandler extends common_1.BaseHandler {
|
|
|
120
120
|
break;
|
|
121
121
|
case 'CHANNEL_DELETE':
|
|
122
122
|
{
|
|
123
|
-
if (!client.components
|
|
123
|
+
if (!client.components.values.size)
|
|
124
124
|
break;
|
|
125
125
|
if (raw.d.type === types_1.ChannelType.DM || raw.d.type === types_1.ChannelType.GroupDM) {
|
|
126
126
|
for (const value of client.components.values) {
|
|
@@ -147,7 +147,7 @@ class EventHandler extends common_1.BaseHandler {
|
|
|
147
147
|
break;
|
|
148
148
|
case 'THREAD_DELETE':
|
|
149
149
|
{
|
|
150
|
-
if (!client.components
|
|
150
|
+
if (!client.components.values.size)
|
|
151
151
|
break;
|
|
152
152
|
for (const value of client.components.values) {
|
|
153
153
|
if (value[1].channelId === raw.d.id) {
|
|
@@ -36,61 +36,6 @@ export declare const THREAD_LIST_SYNC: (_self: UsingClient, data: GatewayThreadL
|
|
|
36
36
|
skuId: string;
|
|
37
37
|
} | null | undefined;
|
|
38
38
|
}[] | undefined;
|
|
39
|
-
} | {
|
|
40
|
-
defaultForumLayout: import("../../types").ForumLayoutType;
|
|
41
|
-
topic?: string | null | undefined;
|
|
42
|
-
lastMessageId?: string | null | undefined;
|
|
43
|
-
rateLimitPerUser?: number | undefined;
|
|
44
|
-
lastPinTimestamp?: string | null | undefined;
|
|
45
|
-
defaultAutoArchiveDuration?: import("../../types").ThreadAutoArchiveDuration | undefined;
|
|
46
|
-
availableTags: {
|
|
47
|
-
id: string;
|
|
48
|
-
name: string;
|
|
49
|
-
moderated: boolean;
|
|
50
|
-
emojiId: string | null;
|
|
51
|
-
emojiName: string | null;
|
|
52
|
-
}[];
|
|
53
|
-
defaultThreadRateLimitPerUser?: number | undefined;
|
|
54
|
-
defaultReactionEmoji: {
|
|
55
|
-
emojiId: string | null;
|
|
56
|
-
emojiName: string | null;
|
|
57
|
-
} | null;
|
|
58
|
-
defaultSortOrder: import("../../types").SortOrderType | null;
|
|
59
|
-
name: string;
|
|
60
|
-
guildId?: string | undefined;
|
|
61
|
-
permissionOverwrites?: {
|
|
62
|
-
id: string;
|
|
63
|
-
type: import("../../types").OverwriteType;
|
|
64
|
-
allow: string;
|
|
65
|
-
deny: string;
|
|
66
|
-
}[] | undefined;
|
|
67
|
-
position: number;
|
|
68
|
-
parentId?: string | null | undefined;
|
|
69
|
-
nsfw?: boolean | undefined;
|
|
70
|
-
id: string;
|
|
71
|
-
type: import("../../types").ChannelType.GuildForum;
|
|
72
|
-
flags?: import("../../types").ChannelFlags | undefined;
|
|
73
|
-
} | {
|
|
74
|
-
defaultAutoArchiveDuration?: import("../../types").ThreadAutoArchiveDuration | undefined;
|
|
75
|
-
defaultThreadRateLimitPerUser?: number | undefined;
|
|
76
|
-
topic?: string | null | undefined;
|
|
77
|
-
id: string;
|
|
78
|
-
type: import("../../types").ChannelType.GuildAnnouncement;
|
|
79
|
-
flags?: import("../../types").ChannelFlags | undefined;
|
|
80
|
-
rateLimitPerUser?: number | undefined;
|
|
81
|
-
lastMessageId?: string | null | undefined;
|
|
82
|
-
lastPinTimestamp?: string | null | undefined;
|
|
83
|
-
name: string;
|
|
84
|
-
guildId?: string | undefined;
|
|
85
|
-
permissionOverwrites?: {
|
|
86
|
-
id: string;
|
|
87
|
-
type: import("../../types").OverwriteType;
|
|
88
|
-
allow: string;
|
|
89
|
-
deny: string;
|
|
90
|
-
}[] | undefined;
|
|
91
|
-
position: number;
|
|
92
|
-
parentId?: string | null | undefined;
|
|
93
|
-
nsfw?: boolean | undefined;
|
|
94
39
|
} | {
|
|
95
40
|
name: string | null;
|
|
96
41
|
applicationId?: string | undefined;
|
|
@@ -140,6 +85,40 @@ export declare const THREAD_LIST_SYNC: (_self: UsingClient, data: GatewayThreadL
|
|
|
140
85
|
id: string;
|
|
141
86
|
type: import("../../types").ChannelType.GuildCategory;
|
|
142
87
|
flags?: import("../../types").ChannelFlags | undefined;
|
|
88
|
+
} | {
|
|
89
|
+
defaultForumLayout: import("../../types").ForumLayoutType;
|
|
90
|
+
topic?: string | null | undefined;
|
|
91
|
+
lastMessageId?: string | null | undefined;
|
|
92
|
+
rateLimitPerUser?: number | undefined;
|
|
93
|
+
lastPinTimestamp?: string | null | undefined;
|
|
94
|
+
defaultAutoArchiveDuration?: import("../../types").ThreadAutoArchiveDuration | undefined;
|
|
95
|
+
availableTags: {
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
moderated: boolean;
|
|
99
|
+
emojiId: string | null;
|
|
100
|
+
emojiName: string | null;
|
|
101
|
+
}[];
|
|
102
|
+
defaultThreadRateLimitPerUser?: number | undefined;
|
|
103
|
+
defaultReactionEmoji: {
|
|
104
|
+
emojiId: string | null;
|
|
105
|
+
emojiName: string | null;
|
|
106
|
+
} | null;
|
|
107
|
+
defaultSortOrder: import("../../types").SortOrderType | null;
|
|
108
|
+
name: string;
|
|
109
|
+
guildId?: string | undefined;
|
|
110
|
+
permissionOverwrites?: {
|
|
111
|
+
id: string;
|
|
112
|
+
type: import("../../types").OverwriteType;
|
|
113
|
+
allow: string;
|
|
114
|
+
deny: string;
|
|
115
|
+
}[] | undefined;
|
|
116
|
+
position: number;
|
|
117
|
+
parentId?: string | null | undefined;
|
|
118
|
+
nsfw?: boolean | undefined;
|
|
119
|
+
id: string;
|
|
120
|
+
type: import("../../types").ChannelType.GuildForum;
|
|
121
|
+
flags?: import("../../types").ChannelFlags | undefined;
|
|
143
122
|
} | {
|
|
144
123
|
topic?: string | null | undefined;
|
|
145
124
|
lastMessageId?: string | null | undefined;
|
|
@@ -215,6 +194,27 @@ export declare const THREAD_LIST_SYNC: (_self: UsingClient, data: GatewayThreadL
|
|
|
215
194
|
flags?: import("../../types").ChannelFlags | undefined;
|
|
216
195
|
rateLimitPerUser?: number | undefined;
|
|
217
196
|
lastMessageId?: string | null | undefined;
|
|
197
|
+
} | {
|
|
198
|
+
defaultAutoArchiveDuration?: import("../../types").ThreadAutoArchiveDuration | undefined;
|
|
199
|
+
defaultThreadRateLimitPerUser?: number | undefined;
|
|
200
|
+
topic?: string | null | undefined;
|
|
201
|
+
id: string;
|
|
202
|
+
type: import("../../types").ChannelType.GuildAnnouncement;
|
|
203
|
+
flags?: import("../../types").ChannelFlags | undefined;
|
|
204
|
+
rateLimitPerUser?: number | undefined;
|
|
205
|
+
lastMessageId?: string | null | undefined;
|
|
206
|
+
lastPinTimestamp?: string | null | undefined;
|
|
207
|
+
name: string;
|
|
208
|
+
guildId?: string | undefined;
|
|
209
|
+
permissionOverwrites?: {
|
|
210
|
+
id: string;
|
|
211
|
+
type: import("../../types").OverwriteType;
|
|
212
|
+
allow: string;
|
|
213
|
+
deny: string;
|
|
214
|
+
}[] | undefined;
|
|
215
|
+
position: number;
|
|
216
|
+
parentId?: string | null | undefined;
|
|
217
|
+
nsfw?: boolean | undefined;
|
|
218
218
|
} | {
|
|
219
219
|
defaultAutoArchiveDuration?: import("../../types").ThreadAutoArchiveDuration | undefined;
|
|
220
220
|
defaultThreadRateLimitPerUser?: number | undefined;
|
|
@@ -76,8 +76,8 @@ export declare class Interaction<FromGuild extends boolean = boolean, Type exten
|
|
|
76
76
|
editOrReply<FR extends boolean = false>(body: InteractionCreateBodyRequest, fetchReply?: FR): Promise<When<FR, WebhookMessageStructure, void>>;
|
|
77
77
|
editMessage(messageId: string, body: InteractionMessageUpdateBodyRequest): Promise<import("./Message").WebhookMessage>;
|
|
78
78
|
editResponse(body: InteractionMessageUpdateBodyRequest): Promise<import("./Message").WebhookMessage>;
|
|
79
|
-
deleteResponse(): Promise<void
|
|
80
|
-
deleteMessage(messageId: string): Promise<void
|
|
79
|
+
deleteResponse(): Promise<void>;
|
|
80
|
+
deleteMessage(messageId: string): Promise<void>;
|
|
81
81
|
followup(body: MessageWebhookCreateBodyRequest): Promise<import("./Message").WebhookMessage>;
|
|
82
82
|
}
|
|
83
83
|
export declare class ApplicationCommandInteraction<FromGuild extends boolean = boolean, Type extends APIApplicationCommandInteraction = APIApplicationCommandInteraction> extends Interaction<FromGuild, Type> {
|
|
@@ -129,7 +129,7 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
129
129
|
// @ts-expect-error
|
|
130
130
|
if (body.data.__exec)
|
|
131
131
|
this.client.components.modals.set(this.user.id, body.data.__exec);
|
|
132
|
-
else if (this.client.components
|
|
132
|
+
else if (this.client.components.modals.has(this.user.id))
|
|
133
133
|
this.client.components.modals.delete(this.user.id);
|
|
134
134
|
}
|
|
135
135
|
return result;
|
|
@@ -97,6 +97,8 @@ export declare class BaseGuildChannel extends BaseChannel<ChannelType> {
|
|
|
97
97
|
setPosition(position: number, reason?: string): Promise<this>;
|
|
98
98
|
setName(name: string, reason?: string): Promise<this>;
|
|
99
99
|
setParent(parent_id: string | null, reason?: string): Promise<this>;
|
|
100
|
+
setRatelimitPerUser(rate_limit_per_user: number | null | undefined): Promise<this>;
|
|
101
|
+
setNsfw(nsfw?: boolean, reason?: string): Promise<this>;
|
|
100
102
|
}
|
|
101
103
|
export interface MessagesMethods extends BaseNoEditableChannel<ChannelType> {
|
|
102
104
|
}
|
|
@@ -208,32 +210,30 @@ export interface TextGuildChannel extends ObjectToLower<Omit<APITextChannel, 'ty
|
|
|
208
210
|
}
|
|
209
211
|
export declare class TextGuildChannel extends BaseGuildChannel {
|
|
210
212
|
type: ChannelType.GuildText;
|
|
211
|
-
setRatelimitPerUser(rate_limit_per_user: number | null | undefined): Promise<this>;
|
|
212
|
-
setNsfw(nsfw?: boolean, reason?: string): Promise<this>;
|
|
213
213
|
}
|
|
214
214
|
export interface DMChannel extends ObjectToLower<APIDMChannel>, MessagesMethods {
|
|
215
215
|
}
|
|
216
216
|
export declare class DMChannel extends BaseNoEditableChannel<ChannelType.DM> {
|
|
217
217
|
type: ChannelType.DM;
|
|
218
218
|
}
|
|
219
|
-
export interface VoiceChannel extends ObjectToLower<Omit<APIGuildVoiceChannel, 'permission_overwrites'>>, Omit<TextGuildChannel,
|
|
219
|
+
export interface VoiceChannel extends ObjectToLower<Omit<APIGuildVoiceChannel, 'permission_overwrites'>>, Omit<TextGuildChannel, keyof BaseGuildChannel>, VoiceChannelMethods, WebhookChannelMethods {
|
|
220
220
|
}
|
|
221
|
-
export declare class VoiceChannel extends
|
|
221
|
+
export declare class VoiceChannel extends BaseGuildChannel {
|
|
222
222
|
type: ChannelType.GuildVoice;
|
|
223
223
|
}
|
|
224
|
-
export interface StageChannel extends ObjectToLower<Omit<APIGuildStageVoiceChannel, 'type'>>, TopicableGuildChannel, VoiceChannelMethods {
|
|
224
|
+
export interface StageChannel extends ObjectToLower<Omit<APIGuildStageVoiceChannel, 'type' | 'permission_overwrites'>>, TopicableGuildChannel, VoiceChannelMethods {
|
|
225
225
|
}
|
|
226
|
-
export declare class StageChannel extends
|
|
226
|
+
export declare class StageChannel extends BaseGuildChannel {
|
|
227
227
|
type: ChannelType.GuildStageVoice;
|
|
228
228
|
}
|
|
229
|
-
export interface MediaChannel extends ObjectToLower<Omit<APIGuildMediaChannel, 'type'>>, ThreadOnlyMethods {
|
|
229
|
+
export interface MediaChannel extends ObjectToLower<Omit<APIGuildMediaChannel, 'type' | 'permission_overwrites'>>, ThreadOnlyMethods {
|
|
230
230
|
}
|
|
231
|
-
export declare class MediaChannel extends
|
|
231
|
+
export declare class MediaChannel extends BaseGuildChannel {
|
|
232
232
|
type: ChannelType.GuildMedia;
|
|
233
233
|
}
|
|
234
|
-
export interface ForumChannel extends ObjectToLower<APIGuildForumChannel
|
|
234
|
+
export interface ForumChannel extends ObjectToLower<Omit<APIGuildForumChannel, 'permission_overwrites'>>, Omit<ThreadOnlyMethods, 'type' | 'edit'>, WebhookChannelMethods {
|
|
235
235
|
}
|
|
236
|
-
export declare class ForumChannel extends
|
|
236
|
+
export declare class ForumChannel extends BaseGuildChannel {
|
|
237
237
|
type: ChannelType.GuildForum;
|
|
238
238
|
}
|
|
239
239
|
export interface ThreadChannel extends ObjectToLower<Omit<APIThreadChannel, 'permission_overwrites'>>, TextBaseGuildChannel {
|
|
@@ -261,9 +261,9 @@ declare const CategoryChannel_base: ToClass<Omit<BaseGuildChannel, "setParent" |
|
|
|
261
261
|
export declare class CategoryChannel extends CategoryChannel_base {
|
|
262
262
|
type: ChannelType.GuildCategory;
|
|
263
263
|
}
|
|
264
|
-
export interface NewsChannel extends ObjectToLower<APINewsChannel
|
|
264
|
+
export interface NewsChannel extends ObjectToLower<Omit<APINewsChannel, 'permission_overwrites'>>, WebhookChannelMethods, Omit<TextGuildChannel, keyof BaseGuildChannel> {
|
|
265
265
|
}
|
|
266
|
-
export declare class NewsChannel extends
|
|
266
|
+
export declare class NewsChannel extends BaseGuildChannel {
|
|
267
267
|
type: ChannelType.GuildAnnouncement;
|
|
268
268
|
addFollower(webhookChannelId: string, reason?: string): Promise<import("../types").APIFollowedChannel>;
|
|
269
269
|
}
|
|
@@ -137,6 +137,12 @@ class BaseGuildChannel extends BaseChannel {
|
|
|
137
137
|
setParent(parent_id, reason) {
|
|
138
138
|
return this.edit({ parent_id }, reason);
|
|
139
139
|
}
|
|
140
|
+
setRatelimitPerUser(rate_limit_per_user) {
|
|
141
|
+
return this.edit({ rate_limit_per_user });
|
|
142
|
+
}
|
|
143
|
+
setNsfw(nsfw = true, reason) {
|
|
144
|
+
return this.edit({ nsfw }, reason);
|
|
145
|
+
}
|
|
140
146
|
}
|
|
141
147
|
exports.BaseGuildChannel = BaseGuildChannel;
|
|
142
148
|
class MessagesMethods extends DiscordBase_1.DiscordBase {
|
|
@@ -333,12 +339,6 @@ class WebhookChannelMethods extends DiscordBase_1.DiscordBase {
|
|
|
333
339
|
}
|
|
334
340
|
exports.WebhookChannelMethods = WebhookChannelMethods;
|
|
335
341
|
let TextGuildChannel = class TextGuildChannel extends BaseGuildChannel {
|
|
336
|
-
setRatelimitPerUser(rate_limit_per_user) {
|
|
337
|
-
return this.edit({ rate_limit_per_user });
|
|
338
|
-
}
|
|
339
|
-
setNsfw(nsfw = true, reason) {
|
|
340
|
-
return this.edit({ nsfw }, reason);
|
|
341
|
-
}
|
|
342
342
|
};
|
|
343
343
|
exports.TextGuildChannel = TextGuildChannel;
|
|
344
344
|
exports.TextGuildChannel = TextGuildChannel = __decorate([
|
|
@@ -350,25 +350,25 @@ exports.DMChannel = DMChannel;
|
|
|
350
350
|
exports.DMChannel = DMChannel = __decorate([
|
|
351
351
|
(0, mixer_1.mix)(MessagesMethods)
|
|
352
352
|
], DMChannel);
|
|
353
|
-
let VoiceChannel = class VoiceChannel extends
|
|
353
|
+
let VoiceChannel = class VoiceChannel extends BaseGuildChannel {
|
|
354
354
|
};
|
|
355
355
|
exports.VoiceChannel = VoiceChannel;
|
|
356
356
|
exports.VoiceChannel = VoiceChannel = __decorate([
|
|
357
|
-
(0, mixer_1.mix)(TextGuildChannel,
|
|
357
|
+
(0, mixer_1.mix)(TextGuildChannel, VoiceChannelMethods)
|
|
358
358
|
], VoiceChannel);
|
|
359
|
-
let StageChannel = class StageChannel extends
|
|
359
|
+
let StageChannel = class StageChannel extends BaseGuildChannel {
|
|
360
360
|
};
|
|
361
361
|
exports.StageChannel = StageChannel;
|
|
362
362
|
exports.StageChannel = StageChannel = __decorate([
|
|
363
363
|
(0, mixer_1.mix)(TopicableGuildChannel, VoiceChannelMethods)
|
|
364
364
|
], StageChannel);
|
|
365
|
-
let MediaChannel = class MediaChannel extends
|
|
365
|
+
let MediaChannel = class MediaChannel extends BaseGuildChannel {
|
|
366
366
|
};
|
|
367
367
|
exports.MediaChannel = MediaChannel;
|
|
368
368
|
exports.MediaChannel = MediaChannel = __decorate([
|
|
369
369
|
(0, mixer_1.mix)(ThreadOnlyMethods)
|
|
370
370
|
], MediaChannel);
|
|
371
|
-
let ForumChannel = class ForumChannel extends
|
|
371
|
+
let ForumChannel = class ForumChannel extends BaseGuildChannel {
|
|
372
372
|
};
|
|
373
373
|
exports.ForumChannel = ForumChannel;
|
|
374
374
|
exports.ForumChannel = ForumChannel = __decorate([
|
|
@@ -423,14 +423,14 @@ exports.ThreadChannel = ThreadChannel = __decorate([
|
|
|
423
423
|
class CategoryChannel extends BaseGuildChannel {
|
|
424
424
|
}
|
|
425
425
|
exports.CategoryChannel = CategoryChannel;
|
|
426
|
-
let NewsChannel = class NewsChannel extends
|
|
426
|
+
let NewsChannel = class NewsChannel extends BaseGuildChannel {
|
|
427
427
|
addFollower(webhookChannelId, reason) {
|
|
428
428
|
return this.client.guilds.channels.addFollower(this.id, webhookChannelId, reason);
|
|
429
429
|
}
|
|
430
430
|
};
|
|
431
431
|
exports.NewsChannel = NewsChannel;
|
|
432
432
|
exports.NewsChannel = NewsChannel = __decorate([
|
|
433
|
-
(0, mixer_1.mix)(WebhookChannelMethods)
|
|
433
|
+
(0, mixer_1.mix)(TextGuildChannel, WebhookChannelMethods)
|
|
434
434
|
], NewsChannel);
|
|
435
435
|
class DirectoryChannel extends BaseChannel {
|
|
436
436
|
}
|
|
@@ -262,10 +262,6 @@ export declare enum GatewayIntentBits {
|
|
|
262
262
|
Guilds = 1,
|
|
263
263
|
GuildMembers = 2,
|
|
264
264
|
GuildModeration = 4,
|
|
265
|
-
/**
|
|
266
|
-
* @deprecated This is the old name for {@apilink GatewayIntentBits#GuildModeration}
|
|
267
|
-
*/
|
|
268
|
-
GuildBans = 4,
|
|
269
265
|
GuildExpressions = 8,
|
|
270
266
|
GuildIntegrations = 16,
|
|
271
267
|
GuildWebhooks = 32,
|
|
@@ -283,7 +279,9 @@ export declare enum GatewayIntentBits {
|
|
|
283
279
|
AutoModerationConfiguration = 1048576,
|
|
284
280
|
AutoModerationExecution = 2097152,
|
|
285
281
|
GuildMessagePolls = 16777216,
|
|
286
|
-
DirectMessagePolls = 33554432
|
|
282
|
+
DirectMessagePolls = 33554432,
|
|
283
|
+
NonPrivilaged = 53575421,
|
|
284
|
+
OnlyPrivilaged = 33026
|
|
287
285
|
}
|
|
288
286
|
/**
|
|
289
287
|
* https://discord.com/developers/docs/topics/gateway-events#receive-events
|
package/lib/types/utils/index.js
CHANGED
|
@@ -246,10 +246,6 @@ var GatewayIntentBits;
|
|
|
246
246
|
GatewayIntentBits[GatewayIntentBits["Guilds"] = 1] = "Guilds";
|
|
247
247
|
GatewayIntentBits[GatewayIntentBits["GuildMembers"] = 2] = "GuildMembers";
|
|
248
248
|
GatewayIntentBits[GatewayIntentBits["GuildModeration"] = 4] = "GuildModeration";
|
|
249
|
-
/**
|
|
250
|
-
* @deprecated This is the old name for {@apilink GatewayIntentBits#GuildModeration}
|
|
251
|
-
*/
|
|
252
|
-
GatewayIntentBits[GatewayIntentBits["GuildBans"] = 4] = "GuildBans";
|
|
253
249
|
GatewayIntentBits[GatewayIntentBits["GuildExpressions"] = 8] = "GuildExpressions";
|
|
254
250
|
GatewayIntentBits[GatewayIntentBits["GuildIntegrations"] = 16] = "GuildIntegrations";
|
|
255
251
|
GatewayIntentBits[GatewayIntentBits["GuildWebhooks"] = 32] = "GuildWebhooks";
|
|
@@ -268,6 +264,8 @@ var GatewayIntentBits;
|
|
|
268
264
|
GatewayIntentBits[GatewayIntentBits["AutoModerationExecution"] = 2097152] = "AutoModerationExecution";
|
|
269
265
|
GatewayIntentBits[GatewayIntentBits["GuildMessagePolls"] = 16777216] = "GuildMessagePolls";
|
|
270
266
|
GatewayIntentBits[GatewayIntentBits["DirectMessagePolls"] = 33554432] = "DirectMessagePolls";
|
|
267
|
+
GatewayIntentBits[GatewayIntentBits["NonPrivilaged"] = 53575421] = "NonPrivilaged";
|
|
268
|
+
GatewayIntentBits[GatewayIntentBits["OnlyPrivilaged"] = 33026] = "OnlyPrivilaged";
|
|
271
269
|
})(GatewayIntentBits || (exports.GatewayIntentBits = GatewayIntentBits = {}));
|
|
272
270
|
/**
|
|
273
271
|
* https://discord.com/developers/docs/topics/gateway-events#receive-events
|