From 66e58d5c2b7844f27c99441d92ead4aae780a4e0 Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Mon, 29 Mar 2021 10:20:27 +0200 Subject: [PATCH] types: add template types (#706) * types: add CreateGuildFromTemplate type * types: add ModifyGuildTemplate type * types: add Template type * types: add VoiceRegion type * types: add VoiceState type * Revert "types: add VoiceRegion type" This reverts commit d1c13d4658b7f1fca20d69eaf2f56efda586c244. * Revert "types: add VoiceState type" This reverts commit 322970dda823b8bd0d77e3489377ccbf69b5aa17. * Update src/types/templates/modify_guild_template.ts * Update src/types/templates/template.ts * Update src/types/templates/template.ts Co-authored-by: ayntee --- .../templates/create_guild_from_template.ts | 9 ++++++ src/types/templates/modify_guild_template.ts | 9 ++++++ src/types/templates/template.ts | 30 +++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 src/types/templates/create_guild_from_template.ts create mode 100644 src/types/templates/modify_guild_template.ts create mode 100644 src/types/templates/template.ts diff --git a/src/types/templates/create_guild_from_template.ts b/src/types/templates/create_guild_from_template.ts new file mode 100644 index 000000000..5f2ec272a --- /dev/null +++ b/src/types/templates/create_guild_from_template.ts @@ -0,0 +1,9 @@ +export interface CreateGuildFromTemplate { + /** Name of the guild (2-100 characters) */ + name: string; + /** base64 128x128 image for the guild icon */ + icon?: string; +} + +/** https://discord.com/developers/docs/resources/template#create-guild-from-template-json-params */ +export type DiscordCreateGuildFromTemplate = CreateGuildFromTemplate; diff --git a/src/types/templates/modify_guild_template.ts b/src/types/templates/modify_guild_template.ts new file mode 100644 index 000000000..892c3cf44 --- /dev/null +++ b/src/types/templates/modify_guild_template.ts @@ -0,0 +1,9 @@ +export interface ModifyGuildTemplate { + /** Name of the template (1-100 characters) */ + name?: string; + /** Description of the template (0-120 characters) */ + description?: string | null; +} + +/** https://discord.com/developers/docs/resources/template#modify-guild-template */ +export type DiscordModifyGuildTemplate = ModifyGuildTemplate; diff --git a/src/types/templates/template.ts b/src/types/templates/template.ts new file mode 100644 index 000000000..39610b45b --- /dev/null +++ b/src/types/templates/template.ts @@ -0,0 +1,30 @@ +import { SnakeCaseProps } from "../util.ts"; +import { User } from "../users/user.ts"; + +export interface Template { + /** The template code (unique ID) */ + code: string; + /** Template name */ + name: string; + /** The description for the template */ + description: string | null; + /** Number of times this template has been used */ + usageCount: number; + /** The ID of the user who created the template */ + creatorId: string; + /** The user who created the template */ + creator: User; + /** When this template was created */ + createdAt: string; + /** When this template was last synced to the source guild */ + updatedAt: string; + /** The ID of the guild this template is based on */ + sourceGuildId: string; + /** The guild snapshot this template contains */ + serializedSourceGuild: Partial; + /** Whether the template has unsynced changes */ + isDirty: boolean | null; +} + +/** https://discord.com/developers/docs/resources/template#template-object-template-structure */ +export type DiscordTemplate = SnakeCaseProps