mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-04 05:56:09 +00:00

* feat: add support for new Discord application emojis features * feat: add support for new Discord application emojis features * feat: applications emojis routes * chore: switch typings provider * fix: unnecesary type * feat: magic bytes * chore: move api-types * chore: ? * fix: omg npm * chore: apply formatting * fix: for fast merge --------- Co-authored-by: Tony Supremacy <165050835+VanStk@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
import type { APITemplate, RESTPatchAPIGuildTemplateJSONBody, RESTPostAPIGuildTemplatesJSONBody } from '../types';
|
|
import type { UsingClient } from '../commands';
|
|
import type { MethodContext, ObjectToLower } from '../common';
|
|
import { Base } from './extra/Base';
|
|
|
|
export interface GuildTemplate extends Base, ObjectToLower<APITemplate> {}
|
|
|
|
export class GuildTemplate extends Base {
|
|
constructor(client: UsingClient, data: APITemplate) {
|
|
super(client);
|
|
this.__patchThis(data);
|
|
}
|
|
|
|
guild(force = false) {
|
|
return this.client.guilds.fetch(this.sourceGuildId, force);
|
|
}
|
|
|
|
async fetch() {
|
|
return this.client.templates.fetch(this.sourceGuildId);
|
|
}
|
|
|
|
sync() {
|
|
return this.client.templates.sync(this.sourceGuildId, this.code);
|
|
}
|
|
|
|
edit(body: RESTPatchAPIGuildTemplateJSONBody) {
|
|
return this.client.templates.edit(this.sourceGuildId, this.code, body);
|
|
}
|
|
|
|
delete() {
|
|
return this.client.templates.delete(this.sourceGuildId, this.code);
|
|
}
|
|
|
|
static methods(ctx: MethodContext<{ guildId: string }>) {
|
|
return {
|
|
fetch: (code: string) => ctx.client.templates.fetch(code),
|
|
list: () => ctx.client.templates.list(ctx.guildId),
|
|
create: (body: RESTPostAPIGuildTemplatesJSONBody) => ctx.client.templates.create(ctx.guildId, body),
|
|
sync: (code: string) => ctx.client.templates.sync(ctx.guildId, code),
|
|
edit: (code: string, body: RESTPatchAPIGuildTemplateJSONBody) =>
|
|
ctx.client.templates.edit(ctx.guildId, code, body),
|
|
delete: (code: string) => ctx.client.templates.delete(ctx.guildId, code),
|
|
};
|
|
}
|
|
}
|