seyfert 2.2.1-dev-13338418043.0 → 2.2.1-dev-13377648432.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/common/it/utils.js +1 -11
- package/lib/common/shorters/application.d.ts +5 -5
- package/lib/common/shorters/application.js +4 -4
- package/lib/common/shorters/channels.js +1 -1
- package/lib/langs/handler.d.ts +1 -4
- package/lib/langs/handler.js +11 -3
- package/lib/structures/Application.d.ts +7 -6
- package/lib/structures/Emoji.d.ts +4 -5
- package/lib/structures/Emoji.js +2 -2
- package/package.json +1 -1
package/lib/common/it/utils.js
CHANGED
|
@@ -261,17 +261,7 @@ exports.ReplaceRegex = {
|
|
|
261
261
|
},
|
|
262
262
|
};
|
|
263
263
|
async function magicImport(path) {
|
|
264
|
-
|
|
265
|
-
if ('Deno' in globalThis)
|
|
266
|
-
throw new Error('https://github.com/denoland/deno/issues/26136');
|
|
267
|
-
return require(path);
|
|
268
|
-
}
|
|
269
|
-
catch (e) {
|
|
270
|
-
// (bun)dows moment
|
|
271
|
-
if (!('Bun' in globalThis) || e.message.includes('is unsupported. use "await import()" instead.'))
|
|
272
|
-
return new Function('path', 'return import(`file:///${path}?update=${Date.now()}`)')(path.split('\\').join('\\\\'));
|
|
273
|
-
throw new Error(`Cannot import ${path}`, { cause: e });
|
|
274
|
-
}
|
|
264
|
+
return new Function('path', 'return import(`file:///${path}?update=${Date.now()}`)')(path);
|
|
275
265
|
}
|
|
276
266
|
function fakePromise(value) {
|
|
277
267
|
if (value instanceof Promise)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ApplicationEmojiStructure, type EntitlementStructure } from '../../client';
|
|
1
|
+
import { type ApplicationEmojiStructure, type ApplicationStructure, type EntitlementStructure } from '../../client';
|
|
2
2
|
import type { RESTGetAPIEntitlementsQuery, RESTPatchAPIApplicationEmojiJSONBody, RESTPatchCurrentApplicationJSONBody, RESTPostAPIEntitlementBody } from '../../types';
|
|
3
3
|
import type { ApplicationEmojiResolvable } from '../types/resolvables';
|
|
4
4
|
import { BaseShorter } from './base';
|
|
@@ -20,14 +20,14 @@ export declare class ApplicationShorter extends BaseShorter {
|
|
|
20
20
|
* @param body.image The [image data string](https://discord.com/developers/docs/reference#image-data) of the emoji.
|
|
21
21
|
* @returns The created emoji.
|
|
22
22
|
*/
|
|
23
|
-
createEmoji(raw: ApplicationEmojiResolvable): Promise<
|
|
23
|
+
createEmoji(raw: ApplicationEmojiResolvable): Promise<ApplicationEmojiStructure>;
|
|
24
24
|
/**
|
|
25
25
|
* Edits an emoji for the application.
|
|
26
26
|
* @param emojiId The ID of the emoji.
|
|
27
27
|
* @param body.name The new name of the emoji.
|
|
28
28
|
* @returns The edited emoji.
|
|
29
29
|
*/
|
|
30
|
-
editEmoji(emojiId: string, body: RESTPatchAPIApplicationEmojiJSONBody): Promise<
|
|
30
|
+
editEmoji(emojiId: string, body: RESTPatchAPIApplicationEmojiJSONBody): Promise<ApplicationEmojiStructure>;
|
|
31
31
|
/**
|
|
32
32
|
* Deletes an emoji for the application.
|
|
33
33
|
* @param emojiId The ID of the emoji.
|
|
@@ -58,7 +58,7 @@ export declare class ApplicationShorter extends BaseShorter {
|
|
|
58
58
|
* @returns The SKUs.
|
|
59
59
|
*/
|
|
60
60
|
listSKUs(): Promise<import("../../types").RESTGetAPISKUsResult>;
|
|
61
|
-
fetch(): Promise<
|
|
62
|
-
edit(body: RESTPatchCurrentApplicationJSONBody): Promise<
|
|
61
|
+
fetch(): Promise<ApplicationStructure>;
|
|
62
|
+
edit(body: RESTPatchCurrentApplicationJSONBody): Promise<ApplicationStructure>;
|
|
63
63
|
getActivityInstance(instanceId: string): Promise<import("../../types").RestGetAPIApplicationActivityInstanceResult>;
|
|
64
64
|
}
|
|
@@ -16,7 +16,7 @@ class ApplicationShorter extends base_1.BaseShorter {
|
|
|
16
16
|
return cached;
|
|
17
17
|
}
|
|
18
18
|
const data = await this.client.proxy.applications(this.client.applicationId).emojis.get();
|
|
19
|
-
this.client.cache.emojis?.set(__1.CacheFrom.Rest, data.items.map(e => [e.id, e]), this.client.applicationId);
|
|
19
|
+
await this.client.cache.emojis?.set(__1.CacheFrom.Rest, data.items.map(e => [e.id, e]), this.client.applicationId);
|
|
20
20
|
return data.items.map(e => client_1.Transformers.ApplicationEmoji(this.client, e));
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
@@ -31,7 +31,7 @@ class ApplicationShorter extends base_1.BaseShorter {
|
|
|
31
31
|
return cached;
|
|
32
32
|
}
|
|
33
33
|
const data = await this.client.proxy.applications(this.client.applicationId).emojis(emojiId).get();
|
|
34
|
-
this.client.cache.emojis?.set(__1.CacheFrom.Rest, data.id, this.client.applicationId, data);
|
|
34
|
+
await this.client.cache.emojis?.set(__1.CacheFrom.Rest, data.id, this.client.applicationId, data);
|
|
35
35
|
return client_1.Transformers.ApplicationEmoji(this.client, data);
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
@@ -44,7 +44,7 @@ class ApplicationShorter extends base_1.BaseShorter {
|
|
|
44
44
|
const data = await this.client.proxy
|
|
45
45
|
.applications(this.client.applicationId)
|
|
46
46
|
.emojis.post({ body: { ...raw, image: await (0, __1.resolveImage)(raw.image) } });
|
|
47
|
-
this.client.cache.emojis?.set(__1.CacheFrom.Rest, data.id, this.client.applicationId, data);
|
|
47
|
+
await this.client.cache.emojis?.set(__1.CacheFrom.Rest, data.id, this.client.applicationId, data);
|
|
48
48
|
return client_1.Transformers.ApplicationEmoji(this.client, data);
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
@@ -55,7 +55,7 @@ class ApplicationShorter extends base_1.BaseShorter {
|
|
|
55
55
|
*/
|
|
56
56
|
async editEmoji(emojiId, body) {
|
|
57
57
|
const data = await this.client.proxy.applications(this.client.applicationId).emojis(emojiId).patch({ body });
|
|
58
|
-
this.client.cache.emojis?.patch(__1.CacheFrom.Rest, emojiId, this.client.applicationId, data);
|
|
58
|
+
await this.client.cache.emojis?.patch(__1.CacheFrom.Rest, emojiId, this.client.applicationId, data);
|
|
59
59
|
return client_1.Transformers.ApplicationEmoji(this.client, data);
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
@@ -21,8 +21,8 @@ class ChannelShorter extends base_1.BaseShorter {
|
|
|
21
21
|
async raw(id, force) {
|
|
22
22
|
if (!force) {
|
|
23
23
|
const channel = await this.client.cache.channels?.raw(id);
|
|
24
|
-
const overwrites = await this.client.cache.overwrites?.raw(id);
|
|
25
24
|
if (channel) {
|
|
25
|
+
const overwrites = await this.client.cache.overwrites?.raw(id);
|
|
26
26
|
if (overwrites)
|
|
27
27
|
channel.permission_overwrites = overwrites;
|
|
28
28
|
return channel;
|
package/lib/langs/handler.d.ts
CHANGED
|
@@ -15,10 +15,7 @@ export declare class LangsHandler extends BaseHandler {
|
|
|
15
15
|
load(dir: string): Promise<void>;
|
|
16
16
|
parse(file: LangInstance): void;
|
|
17
17
|
set(instances: LangInstance[]): void;
|
|
18
|
-
reload(lang: string): Promise<
|
|
19
|
-
file: Record<string, any>;
|
|
20
|
-
locale: string;
|
|
21
|
-
} | null>;
|
|
18
|
+
reload(lang: string): Promise<Record<string, any> | null>;
|
|
22
19
|
reloadAll(stopIfFail?: boolean): Promise<void>;
|
|
23
20
|
onFile(locale: string, { file }: LangInstance): {
|
|
24
21
|
file: Record<string, any>;
|
package/lib/langs/handler.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LangsHandler = void 0;
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
4
5
|
const common_1 = require("../common");
|
|
5
6
|
const router_1 = require("./router");
|
|
6
7
|
class LangsHandler extends common_1.BaseHandler {
|
|
@@ -55,11 +56,18 @@ class LangsHandler extends common_1.BaseHandler {
|
|
|
55
56
|
if ((0, common_1.isCloudfareWorker)()) {
|
|
56
57
|
throw new Error('Reload in cloudfare worker is not supported');
|
|
57
58
|
}
|
|
58
|
-
const
|
|
59
|
+
const path = this.__paths[lang];
|
|
60
|
+
if (!path)
|
|
61
|
+
return null;
|
|
62
|
+
delete require.cache[path];
|
|
63
|
+
const value = await (0, common_1.magicImport)(path).then(x => this.onFile(lang, {
|
|
64
|
+
file: x,
|
|
65
|
+
name: (0, node_path_1.basename)(path),
|
|
66
|
+
path,
|
|
67
|
+
}));
|
|
59
68
|
if (!value)
|
|
60
69
|
return null;
|
|
61
|
-
|
|
62
|
-
return (this.values[lang] = await (0, common_1.magicImport)(value).then(x => this.onFile(lang, x)));
|
|
70
|
+
return (this.values[lang] = value.file);
|
|
63
71
|
}
|
|
64
72
|
async reloadAll(stopIfFail = true) {
|
|
65
73
|
for (const i in this.__paths) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { UsingClient } from '..';
|
|
2
|
+
import type { ApplicationEmojiStructure, ApplicationStructure } from '../client';
|
|
2
3
|
import type { ApplicationEmojiResolvable, ObjectToLower } from '../common';
|
|
3
4
|
import type { APIApplication, RESTPatchAPIApplicationEmojiJSONBody, RESTPatchCurrentApplicationJSONBody } from '../types';
|
|
4
5
|
import { DiscordBase } from './extra/DiscordBase';
|
|
@@ -12,11 +13,11 @@ export declare class Application extends DiscordBase<APIApplication> {
|
|
|
12
13
|
/**
|
|
13
14
|
* Fetch the current application.
|
|
14
15
|
*/
|
|
15
|
-
fetch(): Promise<
|
|
16
|
+
fetch(): Promise<ApplicationStructure>;
|
|
16
17
|
/**
|
|
17
18
|
* Edit the current application.
|
|
18
19
|
*/
|
|
19
|
-
edit(data: RESTPatchCurrentApplicationJSONBody): Promise<
|
|
20
|
+
edit(data: RESTPatchCurrentApplicationJSONBody): Promise<ApplicationStructure>;
|
|
20
21
|
/**
|
|
21
22
|
* Get an activity instance.
|
|
22
23
|
*/
|
|
@@ -25,18 +26,18 @@ export declare class Application extends DiscordBase<APIApplication> {
|
|
|
25
26
|
/**
|
|
26
27
|
* Get an application emoji.
|
|
27
28
|
*/
|
|
28
|
-
fetch: (id: string) => Promise<
|
|
29
|
+
fetch: (id: string) => Promise<ApplicationEmojiStructure>;
|
|
29
30
|
/**
|
|
30
31
|
* Get the application emojis.
|
|
31
32
|
*/
|
|
32
|
-
list: () => Promise<
|
|
33
|
+
list: () => Promise<ApplicationEmojiStructure[]>;
|
|
33
34
|
/**
|
|
34
35
|
* Create an application emoji.
|
|
35
36
|
*/
|
|
36
|
-
create: (data: ApplicationEmojiResolvable) => Promise<
|
|
37
|
+
create: (data: ApplicationEmojiResolvable) => Promise<ApplicationEmojiStructure>;
|
|
37
38
|
/**
|
|
38
39
|
* Edit an application emoji.
|
|
39
40
|
*/
|
|
40
|
-
edit: (emojiId: string, body: RESTPatchAPIApplicationEmojiJSONBody) => Promise<
|
|
41
|
+
edit: (emojiId: string, body: RESTPatchAPIApplicationEmojiJSONBody) => Promise<ApplicationEmojiStructure>;
|
|
41
42
|
};
|
|
42
43
|
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import type { BaseCDNUrlOptions } from '../api';
|
|
2
2
|
import type { ReturnCache } from '../cache';
|
|
3
|
-
import type
|
|
3
|
+
import { type ApplicationEmojiStructure, type GuildEmojiStructure, type GuildStructure, type UserStructure } from '../client';
|
|
4
4
|
import type { UsingClient } from '../commands';
|
|
5
5
|
import { type EmojiShorter, type MethodContext, type ObjectToLower, type When } from '../common';
|
|
6
6
|
import type { APIApplicationEmoji, APIEmoji, RESTPatchAPIApplicationEmojiJSONBody, RESTPatchAPIGuildEmojiJSONBody } from '../types';
|
|
7
|
-
import { User } from './User';
|
|
8
7
|
import { DiscordBase } from './extra/DiscordBase';
|
|
9
8
|
export interface Emoji extends DiscordBase, ObjectToLower<Omit<APIEmoji, 'id' | 'user'>> {
|
|
10
9
|
}
|
|
11
10
|
export declare class Emoji<T extends boolean = false> extends DiscordBase {
|
|
12
|
-
user: When<T,
|
|
11
|
+
user: When<T, UserStructure>;
|
|
13
12
|
constructor(client: UsingClient, data: APIEmoji);
|
|
14
13
|
url(options?: BaseCDNUrlOptions): string;
|
|
15
14
|
toString(): string;
|
|
@@ -40,7 +39,7 @@ export declare class GuildEmoji extends Emoji {
|
|
|
40
39
|
}
|
|
41
40
|
export declare class ApplicationEmoji extends Emoji<true> {
|
|
42
41
|
constructor(client: UsingClient, data: APIApplicationEmoji);
|
|
43
|
-
fetch(): Promise<
|
|
44
|
-
edit(body: RESTPatchAPIApplicationEmojiJSONBody): Promise<
|
|
42
|
+
fetch(): Promise<ApplicationEmojiStructure>;
|
|
43
|
+
edit(body: RESTPatchAPIApplicationEmojiJSONBody): Promise<ApplicationEmojiStructure>;
|
|
45
44
|
delete(): Promise<never>;
|
|
46
45
|
}
|
package/lib/structures/Emoji.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ApplicationEmoji = exports.GuildEmoji = exports.Emoji = void 0;
|
|
4
|
+
const client_1 = require("../client");
|
|
4
5
|
const common_1 = require("../common");
|
|
5
|
-
const User_1 = require("./User");
|
|
6
6
|
const DiscordBase_1 = require("./extra/DiscordBase");
|
|
7
7
|
class Emoji extends DiscordBase_1.DiscordBase {
|
|
8
8
|
user;
|
|
9
9
|
constructor(client, data) {
|
|
10
10
|
super(client, { ...data, id: data.id });
|
|
11
|
-
this.user = (data.user &&
|
|
11
|
+
this.user = (data.user && client_1.Transformers.User(client, data.user));
|
|
12
12
|
}
|
|
13
13
|
url(options) {
|
|
14
14
|
return this.rest.cdn.emojis(this.id).get(options);
|