seyfert 2.1.1-dev-11520718826.0 → 2.1.1-dev-11533244769.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/api/shared.d.ts +1 -1
- package/lib/builders/Attachment.d.ts +1 -1
- package/lib/builders/Attachment.js +2 -1
- package/lib/cache/resources/default/base.d.ts +1 -0
- package/lib/cache/resources/default/base.js +7 -0
- package/lib/cache/resources/default/guild-based.d.ts +1 -0
- package/lib/cache/resources/default/guild-based.js +12 -0
- package/lib/cache/resources/default/guild-related.d.ts +1 -0
- package/lib/cache/resources/default/guild-related.js +7 -0
- package/lib/client/base.d.ts +11 -10
- package/lib/types/payloads/_interactions/_applicationCommands/permissions.js +0 -1
- package/lib/types/utils/index.js +1 -6
- package/package.json +1 -1
package/lib/api/shared.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export interface ApiHandlerInternalOptions extends MakeRequired<ApiHandlerOption
|
|
|
18
18
|
}
|
|
19
19
|
export interface RawFile {
|
|
20
20
|
contentType?: string;
|
|
21
|
-
data: ArrayBuffer | Buffer | Uint8Array | boolean | number | string;
|
|
21
|
+
data: ArrayBuffer | Buffer | Uint8Array | Uint8ClampedArray | boolean | number | string;
|
|
22
22
|
key?: string;
|
|
23
23
|
filename: string;
|
|
24
24
|
}
|
|
@@ -4,7 +4,7 @@ import { Base } from '../structures/extra/Base';
|
|
|
4
4
|
import type { APIAttachment, RESTAPIAttachment } from '../types';
|
|
5
5
|
export interface AttachmentResolvableMap {
|
|
6
6
|
url: string;
|
|
7
|
-
buffer: Buffer | ArrayBuffer;
|
|
7
|
+
buffer: Buffer | ArrayBuffer | Uint8Array | Uint8ClampedArray;
|
|
8
8
|
path: string;
|
|
9
9
|
}
|
|
10
10
|
export type AttachmentResolvable = AttachmentResolvableMap[keyof AttachmentResolvableMap] | AttachmentBuilder | Attachment;
|
|
@@ -12,6 +12,7 @@ exports.resolveImage = resolveImage;
|
|
|
12
12
|
const node_crypto_1 = require("node:crypto");
|
|
13
13
|
const node_fs_1 = require("node:fs");
|
|
14
14
|
const node_path_1 = __importDefault(require("node:path"));
|
|
15
|
+
const utils_1 = require("../api/utils/utils");
|
|
15
16
|
const Base_1 = require("../structures/extra/Base");
|
|
16
17
|
class Attachment extends Base_1.Base {
|
|
17
18
|
data;
|
|
@@ -171,7 +172,7 @@ async function resolveAttachmentData(data, type) {
|
|
|
171
172
|
return { data: await node_fs_1.promises.readFile(file) };
|
|
172
173
|
}
|
|
173
174
|
case 'buffer': {
|
|
174
|
-
if (
|
|
175
|
+
if ((0, utils_1.isBufferLike)(data))
|
|
175
176
|
return { data };
|
|
176
177
|
// @ts-expect-error
|
|
177
178
|
if (typeof data[Symbol.asyncIterator] === 'function') {
|
|
@@ -22,5 +22,6 @@ export declare class BaseResource<T = any, S = any> {
|
|
|
22
22
|
getToRelationship(): import("../../../common").Awaitable<string[]>;
|
|
23
23
|
addToRelationship(id: string | string[]): import("../../../common").Awaitable<void>;
|
|
24
24
|
removeToRelationship(id: string | string[]): import("../../../common").Awaitable<void>;
|
|
25
|
+
flush(): import("../../../common").Awaitable<void>;
|
|
25
26
|
hashId(id: string): string;
|
|
26
27
|
}
|
|
@@ -74,6 +74,13 @@ class BaseResource {
|
|
|
74
74
|
removeToRelationship(id) {
|
|
75
75
|
return this.adapter.removeToRelationship(this.namespace, id);
|
|
76
76
|
}
|
|
77
|
+
flush() {
|
|
78
|
+
return (0, common_1.fakePromise)(this.adapter.keys(this.namespace)).then(keys => {
|
|
79
|
+
return (0, common_1.fakePromise)(this.adapter.bulkRemove(keys)).then(() => {
|
|
80
|
+
return this.adapter.removeRelationship(this.namespace);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
77
84
|
hashId(id) {
|
|
78
85
|
return id.startsWith(this.namespace) ? id : `${this.namespace}.${id}`;
|
|
79
86
|
}
|
|
@@ -34,4 +34,5 @@ export declare class GuildBasedResource<T = any, S = any> {
|
|
|
34
34
|
removeRelationship(id: string | string[]): import("../../../common").Awaitable<void>;
|
|
35
35
|
hashId(id: string): string;
|
|
36
36
|
hashGuildId(guild: string, id: string): string;
|
|
37
|
+
flush(guild?: '*' | (string & {})): unknown[] | Promise<unknown[]>;
|
|
37
38
|
}
|
|
@@ -93,5 +93,17 @@ class GuildBasedResource {
|
|
|
93
93
|
hashGuildId(guild, id) {
|
|
94
94
|
return id.startsWith(this.namespace) ? id : `${this.namespace}.${guild}.${id}`;
|
|
95
95
|
}
|
|
96
|
+
flush(guild = '*') {
|
|
97
|
+
return (0, common_1.fakePromise)(this.keys(guild)).then(keys => {
|
|
98
|
+
return (0, common_1.fakePromise)(this.adapter.bulkRemove(keys)).then(() => {
|
|
99
|
+
const maybePromises = [];
|
|
100
|
+
for (const i of keys) {
|
|
101
|
+
const guildId = i.split('.').at(-2);
|
|
102
|
+
maybePromises.push(this.removeRelationship(guildId));
|
|
103
|
+
}
|
|
104
|
+
return this.adapter.isAsync ? Promise.all(maybePromises) : maybePromises;
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
96
108
|
}
|
|
97
109
|
exports.GuildBasedResource = GuildBasedResource;
|
|
@@ -33,4 +33,5 @@ export declare class GuildRelatedResource<T = any, S = any> {
|
|
|
33
33
|
removeToRelationship(id: string | string[], guild: string): import("../../../common").Awaitable<void>;
|
|
34
34
|
removeRelationship(id: string | string[]): import("../../../common").Awaitable<void>;
|
|
35
35
|
hashId(id: string): string;
|
|
36
|
+
flush(guild: string): import("../../../common").Awaitable<void>;
|
|
36
37
|
}
|
|
@@ -99,5 +99,12 @@ class GuildRelatedResource {
|
|
|
99
99
|
hashId(id) {
|
|
100
100
|
return id.startsWith(this.namespace) ? id : `${this.namespace}.${id}`;
|
|
101
101
|
}
|
|
102
|
+
flush(guild) {
|
|
103
|
+
return (0, common_1.fakePromise)(this.keys(guild)).then(keys => {
|
|
104
|
+
return (0, common_1.fakePromise)(this.adapter.bulkRemove(keys)).then(() => {
|
|
105
|
+
return this.removeRelationship(guild);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
}
|
|
102
109
|
}
|
|
103
110
|
exports.GuildRelatedResource = GuildRelatedResource;
|
package/lib/client/base.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export declare class BaseClient {
|
|
|
68
68
|
getRC<T extends InternalRuntimeConfigHTTP | InternalRuntimeConfig = InternalRuntimeConfigHTTP | InternalRuntimeConfig>(): Promise<{
|
|
69
69
|
debug: boolean;
|
|
70
70
|
} & Omit<T, "debug" | "locations"> & {
|
|
71
|
-
locations:
|
|
71
|
+
locations: RCLocations;
|
|
72
72
|
}>;
|
|
73
73
|
}
|
|
74
74
|
export interface BaseClientOptions {
|
|
@@ -121,17 +121,18 @@ export interface StartOptions {
|
|
|
121
121
|
};
|
|
122
122
|
token: string;
|
|
123
123
|
}
|
|
124
|
+
interface RCLocations extends ExtendedRCLocations {
|
|
125
|
+
base: string;
|
|
126
|
+
output: string;
|
|
127
|
+
commands?: string;
|
|
128
|
+
langs?: string;
|
|
129
|
+
templates?: string;
|
|
130
|
+
events?: string;
|
|
131
|
+
components?: string;
|
|
132
|
+
}
|
|
124
133
|
interface RC extends ExtendedRC {
|
|
125
134
|
debug?: boolean;
|
|
126
|
-
locations:
|
|
127
|
-
base: string;
|
|
128
|
-
output: string;
|
|
129
|
-
commands?: string;
|
|
130
|
-
langs?: string;
|
|
131
|
-
templates?: string;
|
|
132
|
-
events?: string;
|
|
133
|
-
components?: string;
|
|
134
|
-
} & ExtendedRCLocations;
|
|
135
|
+
locations: RCLocations;
|
|
135
136
|
token: string;
|
|
136
137
|
intents?: number;
|
|
137
138
|
applicationId?: string;
|
|
@@ -14,7 +14,6 @@ var ApplicationCommandPermissionType;
|
|
|
14
14
|
* https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-constants
|
|
15
15
|
*/
|
|
16
16
|
exports.APIApplicationCommandPermissionsConstant = {
|
|
17
|
-
// eslint-disable-next-line unicorn/prefer-native-coercion-functions
|
|
18
17
|
Everyone: (guildId) => String(guildId),
|
|
19
18
|
AllChannels: (guildId) => String(BigInt(guildId) - 1n),
|
|
20
19
|
};
|
package/lib/types/utils/index.js
CHANGED
|
@@ -55,9 +55,7 @@ exports.FormattingPatterns = {
|
|
|
55
55
|
*
|
|
56
56
|
* The `fullName` (possibly including `name`, `subcommandOrGroup` and `subcommand`) and `id` group properties are present on the `exec` result of this expression
|
|
57
57
|
*/
|
|
58
|
-
SlashCommand:
|
|
59
|
-
// eslint-disable-next-line unicorn/no-unsafe-regex
|
|
60
|
-
/<\/(?<fullName>(?<name>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32})(?: (?<subcommandOrGroup>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?(?: (?<subcommand>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?):(?<id>\d{17,20})>/u,
|
|
58
|
+
SlashCommand: /<\/(?<fullName>(?<name>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32})(?: (?<subcommandOrGroup>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?(?: (?<subcommand>[-_\p{Letter}\p{Number}\p{sc=Deva}\p{sc=Thai}]{1,32}))?):(?<id>\d{17,20})>/u,
|
|
61
59
|
/**
|
|
62
60
|
* Regular expression for matching a custom emoji, either static or animated
|
|
63
61
|
*
|
|
@@ -81,7 +79,6 @@ exports.FormattingPatterns = {
|
|
|
81
79
|
*
|
|
82
80
|
* The `timestamp` and `style` group properties are present on the `exec` result of this expression
|
|
83
81
|
*/
|
|
84
|
-
// eslint-disable-next-line prefer-named-capture-group
|
|
85
82
|
Timestamp: /<t:(?<timestamp>-?\d{1,13})(:(?<style>[DFRTdft]))?>/,
|
|
86
83
|
/**
|
|
87
84
|
* Regular expression for matching strictly default styled timestamps
|
|
@@ -370,7 +367,6 @@ exports.PermissionFlagsBits = {
|
|
|
370
367
|
/**
|
|
371
368
|
* Allows kicking members
|
|
372
369
|
*/
|
|
373
|
-
// eslint-disable-next-line sonarjs/no-identical-expressions
|
|
374
370
|
KickMembers: 1n << 1n,
|
|
375
371
|
/**
|
|
376
372
|
* Allows banning members
|
|
@@ -729,7 +725,6 @@ var ChannelType;
|
|
|
729
725
|
*
|
|
730
726
|
* @deprecated This is the old name for {@apilink ChannelType#AnnouncementThread}
|
|
731
727
|
*/
|
|
732
|
-
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
733
728
|
ChannelType[ChannelType["GuildNewsThread"] = 10] = "GuildNewsThread";
|
|
734
729
|
/**
|
|
735
730
|
* A temporary sub-channel within a Guild Text channel
|