mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
fix: lol
This commit is contained in:
parent
a677ec795c
commit
3c4043b2b1
@ -1,5 +1,10 @@
|
|||||||
import { CacheFrom, resolveImage } from '../..';
|
import { CacheFrom, resolveImage } from '../..';
|
||||||
import { type ApplicationEmojiStructure, type EntitlementStructure, Transformers } from '../../client';
|
import {
|
||||||
|
type ApplicationEmojiStructure,
|
||||||
|
type ApplicationStructure,
|
||||||
|
type EntitlementStructure,
|
||||||
|
Transformers,
|
||||||
|
} from '../../client';
|
||||||
import type {
|
import type {
|
||||||
APIEntitlement,
|
APIEntitlement,
|
||||||
RESTGetAPIEntitlementsQuery,
|
RESTGetAPIEntitlementsQuery,
|
||||||
@ -23,7 +28,7 @@ export class ApplicationShorter extends BaseShorter {
|
|||||||
if (cached?.length) return cached;
|
if (cached?.length) return cached;
|
||||||
}
|
}
|
||||||
const data = await this.client.proxy.applications(this.client.applicationId).emojis.get();
|
const data = await this.client.proxy.applications(this.client.applicationId).emojis.get();
|
||||||
this.client.cache.emojis?.set(
|
await this.client.cache.emojis?.set(
|
||||||
CacheFrom.Rest,
|
CacheFrom.Rest,
|
||||||
data.items.map(e => [e.id, e]),
|
data.items.map(e => [e.id, e]),
|
||||||
this.client.applicationId,
|
this.client.applicationId,
|
||||||
@ -41,7 +46,7 @@ export class ApplicationShorter extends BaseShorter {
|
|||||||
if (cached) return cached;
|
if (cached) return cached;
|
||||||
}
|
}
|
||||||
const data = await this.client.proxy.applications(this.client.applicationId).emojis(emojiId).get();
|
const data = await this.client.proxy.applications(this.client.applicationId).emojis(emojiId).get();
|
||||||
this.client.cache.emojis?.set(CacheFrom.Rest, data.id, this.client.applicationId, data);
|
await this.client.cache.emojis?.set(CacheFrom.Rest, data.id, this.client.applicationId, data);
|
||||||
return Transformers.ApplicationEmoji(this.client, data);
|
return Transformers.ApplicationEmoji(this.client, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,11 +56,11 @@ export class ApplicationShorter extends BaseShorter {
|
|||||||
* @param body.image The [image data string](https://discord.com/developers/docs/reference#image-data) of the emoji.
|
* @param body.image The [image data string](https://discord.com/developers/docs/reference#image-data) of the emoji.
|
||||||
* @returns The created emoji.
|
* @returns The created emoji.
|
||||||
*/
|
*/
|
||||||
async createEmoji(raw: ApplicationEmojiResolvable) {
|
async createEmoji(raw: ApplicationEmojiResolvable): Promise<ApplicationEmojiStructure> {
|
||||||
const data = await this.client.proxy
|
const data = await this.client.proxy
|
||||||
.applications(this.client.applicationId)
|
.applications(this.client.applicationId)
|
||||||
.emojis.post({ body: { ...raw, image: await resolveImage(raw.image) } });
|
.emojis.post({ body: { ...raw, image: await resolveImage(raw.image) } });
|
||||||
this.client.cache.emojis?.set(CacheFrom.Rest, data.id, this.client.applicationId, data);
|
await this.client.cache.emojis?.set(CacheFrom.Rest, data.id, this.client.applicationId, data);
|
||||||
return Transformers.ApplicationEmoji(this.client, data);
|
return Transformers.ApplicationEmoji(this.client, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,9 +70,9 @@ export class ApplicationShorter extends BaseShorter {
|
|||||||
* @param body.name The new name of the emoji.
|
* @param body.name The new name of the emoji.
|
||||||
* @returns The edited emoji.
|
* @returns The edited emoji.
|
||||||
*/
|
*/
|
||||||
async editEmoji(emojiId: string, body: RESTPatchAPIApplicationEmojiJSONBody) {
|
async editEmoji(emojiId: string, body: RESTPatchAPIApplicationEmojiJSONBody): Promise<ApplicationEmojiStructure> {
|
||||||
const data = await this.client.proxy.applications(this.client.applicationId).emojis(emojiId).patch({ body });
|
const data = await this.client.proxy.applications(this.client.applicationId).emojis(emojiId).patch({ body });
|
||||||
this.client.cache.emojis?.patch(CacheFrom.Rest, emojiId, this.client.applicationId, data);
|
await this.client.cache.emojis?.patch(CacheFrom.Rest, emojiId, this.client.applicationId, data);
|
||||||
return Transformers.ApplicationEmoji(this.client, data);
|
return Transformers.ApplicationEmoji(this.client, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,12 +130,12 @@ export class ApplicationShorter extends BaseShorter {
|
|||||||
return this.client.proxy.applications(this.client.applicationId).skus.get();
|
return this.client.proxy.applications(this.client.applicationId).skus.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetch() {
|
async fetch(): Promise<ApplicationStructure> {
|
||||||
const data = await this.client.proxy.applications('@me').get();
|
const data = await this.client.proxy.applications('@me').get();
|
||||||
return Transformers.Application(this.client, data);
|
return Transformers.Application(this.client, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
async edit(body: RESTPatchCurrentApplicationJSONBody) {
|
async edit(body: RESTPatchCurrentApplicationJSONBody): Promise<ApplicationStructure> {
|
||||||
const data = await this.client.proxy.applications('@me').patch({ body });
|
const data = await this.client.proxy.applications('@me').patch({ body });
|
||||||
return Transformers.Application(this.client, data);
|
return Transformers.Application(this.client, data);
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,8 @@ export class ChannelShorter extends BaseShorter {
|
|||||||
async raw(id: string, force?: boolean): Promise<APIChannel> {
|
async raw(id: string, force?: boolean): Promise<APIChannel> {
|
||||||
if (!force) {
|
if (!force) {
|
||||||
const channel = await this.client.cache.channels?.raw(id);
|
const channel = await this.client.cache.channels?.raw(id);
|
||||||
const overwrites = await this.client.cache.overwrites?.raw(id);
|
|
||||||
if (channel) {
|
if (channel) {
|
||||||
|
const overwrites = await this.client.cache.overwrites?.raw(id);
|
||||||
if (overwrites) (channel as APIGuildChannel<ChannelType>).permission_overwrites = overwrites;
|
if (overwrites) (channel as APIGuildChannel<ChannelType>).permission_overwrites = overwrites;
|
||||||
return channel as APIChannel;
|
return channel as APIChannel;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import type { UsingClient } from '..';
|
import type { UsingClient } from '..';
|
||||||
|
import type { ApplicationEmojiStructure, ApplicationStructure } from '../client';
|
||||||
import type { ApplicationEmojiResolvable, ObjectToLower } from '../common';
|
import type { ApplicationEmojiResolvable, ObjectToLower } from '../common';
|
||||||
import type {
|
import type {
|
||||||
APIApplication,
|
APIApplication,
|
||||||
@ -21,14 +22,14 @@ export class Application extends DiscordBase<APIApplication> {
|
|||||||
/**
|
/**
|
||||||
* Fetch the current application.
|
* Fetch the current application.
|
||||||
*/
|
*/
|
||||||
fetch() {
|
fetch(): Promise<ApplicationStructure> {
|
||||||
return this.client.applications.fetch();
|
return this.client.applications.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit the current application.
|
* Edit the current application.
|
||||||
*/
|
*/
|
||||||
edit(data: RESTPatchCurrentApplicationJSONBody) {
|
edit(data: RESTPatchCurrentApplicationJSONBody): Promise<ApplicationStructure> {
|
||||||
return this.client.applications.edit(data);
|
return this.client.applications.edit(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,19 +44,20 @@ export class Application extends DiscordBase<APIApplication> {
|
|||||||
/**
|
/**
|
||||||
* Get an application emoji.
|
* Get an application emoji.
|
||||||
*/
|
*/
|
||||||
fetch: (id: string) => this.client.applications.getEmoji(id),
|
fetch: (id: string): Promise<ApplicationEmojiStructure> => this.client.applications.getEmoji(id),
|
||||||
/**
|
/**
|
||||||
* Get the application emojis.
|
* Get the application emojis.
|
||||||
*/
|
*/
|
||||||
list: () => this.client.applications.listEmojis(),
|
list: (): Promise<ApplicationEmojiStructure[]> => this.client.applications.listEmojis(),
|
||||||
/**
|
/**
|
||||||
* Create an application emoji.
|
* Create an application emoji.
|
||||||
*/
|
*/
|
||||||
create: (data: ApplicationEmojiResolvable) => this.client.applications.createEmoji(data),
|
create: (data: ApplicationEmojiResolvable): Promise<ApplicationEmojiStructure> =>
|
||||||
|
this.client.applications.createEmoji(data),
|
||||||
/**
|
/**
|
||||||
* Edit an application emoji.
|
* Edit an application emoji.
|
||||||
*/
|
*/
|
||||||
edit: (emojiId: string, body: RESTPatchAPIApplicationEmojiJSONBody) =>
|
edit: (emojiId: string, body: RESTPatchAPIApplicationEmojiJSONBody): Promise<ApplicationEmojiStructure> =>
|
||||||
this.client.applications.editEmoji(emojiId, body),
|
this.client.applications.editEmoji(emojiId, body),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
import type { BaseCDNUrlOptions } from '../api';
|
import type { BaseCDNUrlOptions } from '../api';
|
||||||
import type { ReturnCache } from '../cache';
|
import type { ReturnCache } from '../cache';
|
||||||
import type { GuildEmojiStructure, GuildStructure } from '../client';
|
import {
|
||||||
|
type ApplicationEmojiStructure,
|
||||||
|
type GuildEmojiStructure,
|
||||||
|
type GuildStructure,
|
||||||
|
Transformers,
|
||||||
|
type UserStructure,
|
||||||
|
} from '../client';
|
||||||
import type { UsingClient } from '../commands';
|
import type { UsingClient } from '../commands';
|
||||||
import { type EmojiShorter, Formatter, type MethodContext, type ObjectToLower, type When } from '../common';
|
import { type EmojiShorter, Formatter, type MethodContext, type ObjectToLower, type When } from '../common';
|
||||||
import type {
|
import type {
|
||||||
@ -9,16 +15,15 @@ import type {
|
|||||||
RESTPatchAPIApplicationEmojiJSONBody,
|
RESTPatchAPIApplicationEmojiJSONBody,
|
||||||
RESTPatchAPIGuildEmojiJSONBody,
|
RESTPatchAPIGuildEmojiJSONBody,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import { User } from './User';
|
|
||||||
import { DiscordBase } from './extra/DiscordBase';
|
import { DiscordBase } from './extra/DiscordBase';
|
||||||
|
|
||||||
export interface Emoji extends DiscordBase, ObjectToLower<Omit<APIEmoji, 'id' | 'user'>> {}
|
export interface Emoji extends DiscordBase, ObjectToLower<Omit<APIEmoji, 'id' | 'user'>> {}
|
||||||
|
|
||||||
export class Emoji<T extends boolean = false> extends DiscordBase {
|
export class Emoji<T extends boolean = false> extends DiscordBase {
|
||||||
user: When<T, User>;
|
user: When<T, UserStructure>;
|
||||||
constructor(client: UsingClient, data: APIEmoji) {
|
constructor(client: UsingClient, data: APIEmoji) {
|
||||||
super(client, { ...data, id: data.id! });
|
super(client, { ...data, id: data.id! });
|
||||||
this.user = (data.user && new User(client, data.user)) as never;
|
this.user = (data.user && Transformers.User(client, data.user)) as never;
|
||||||
}
|
}
|
||||||
|
|
||||||
url(options?: BaseCDNUrlOptions) {
|
url(options?: BaseCDNUrlOptions) {
|
||||||
@ -93,11 +98,11 @@ export class ApplicationEmoji extends Emoji<true> {
|
|||||||
super(client, data);
|
super(client, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch() {
|
fetch(): Promise<ApplicationEmojiStructure> {
|
||||||
return this.client.applications.getEmoji(this.id);
|
return this.client.applications.getEmoji(this.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
edit(body: RESTPatchAPIApplicationEmojiJSONBody) {
|
edit(body: RESTPatchAPIApplicationEmojiJSONBody): Promise<ApplicationEmojiStructure> {
|
||||||
return this.client.applications.editEmoji(this.id, body);
|
return this.client.applications.editEmoji(this.id, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user