mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00

* fix: github actions * fix: pnpm version * fix: github actions checkout * fix: brackets in failure function * fix: github actions * fix: github actions * fix: github actions * fix: github actions * fix: github actions * fix: github actions * fix: github actions * fix: github actions * chore: apply formatting * fix: github actions --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import type { RESTPatchAPIGuildTemplateJSONBody, RESTPostAPIGuildTemplatesJSONBody } from 'discord-api-types/v10';
|
|
import { BaseShorter } from './base';
|
|
import { GuildTemplate } from '../..';
|
|
|
|
export class TemplateShorter extends BaseShorter {
|
|
fetch(code: string) {
|
|
return this.client.proxy.guilds
|
|
.templates(code)
|
|
.get()
|
|
.then(template => new GuildTemplate(this.client, template));
|
|
}
|
|
|
|
list(guildId: string) {
|
|
return this.client.proxy
|
|
.guilds(guildId)
|
|
.templates.get()
|
|
.then(list => list.map(template => new GuildTemplate(this.client, template)));
|
|
}
|
|
|
|
create(guildId: string, body: RESTPostAPIGuildTemplatesJSONBody) {
|
|
return this.client.proxy
|
|
.guilds(guildId)
|
|
.templates.post({ body })
|
|
.then(template => new GuildTemplate(this.client, template));
|
|
}
|
|
|
|
sync(guildId: string, code: string) {
|
|
return this.client.proxy
|
|
.guilds(guildId)
|
|
.templates(code)
|
|
.put({})
|
|
.then(template => new GuildTemplate(this.client, template));
|
|
}
|
|
|
|
edit(guildId: string, code: string, body: RESTPatchAPIGuildTemplateJSONBody) {
|
|
return this.client.proxy
|
|
.guilds(guildId)
|
|
.templates(code)
|
|
.patch({ body })
|
|
.then(template => new GuildTemplate(this.client, template));
|
|
}
|
|
|
|
delete(guildId: string, code: string) {
|
|
return this.client.proxy
|
|
.guilds(guildId)
|
|
.templates(code)
|
|
.delete()
|
|
.then(template => new GuildTemplate(this.client, template));
|
|
}
|
|
}
|