-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Document Server Templates #1712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
65d77c7
Document Server Templates
advaith1 bf7fa7f
fix: code, not id
advaith1 292b206
template, not invite, oops
advaith1 f6dc1a3
update wording
advaith1 34dfe0a
Document unknown template error code
advaith1 b14f645
icon_hash guild property
advaith1 8276f75
description can be null
advaith1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# Template Resource | ||
|
||
### Template Object | ||
|
||
Represents a code that when used, creates a new guild duplicated from an existing one. | ||
|
||
###### Template Structure | ||
|
||
| Field | Type | Description | | ||
| ----------------------- | ---------------------------------------------------------------- | -------------------------------------------- | | ||
| code | string | the invite code (unique ID) | | ||
advaith1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| name | string | template name | | ||
| description | string | the description for the template | | ||
| usage_count | integer | number of times this template has been used | | ||
| creator_id | snowflake | the ID of the user who created the template | | ||
| creator | [user](#DOCS_RESOURCES_USER/user-object) object | the user who created the template | | ||
| created_at | ISO8601 timestamp | when this template was created | | ||
| updated_at | ISO8601 timestamp | when this template was last synced | | ||
| source_guild_id | snowflake | the ID of the guild this template duplicates | | ||
advaith1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| serialized_source_guild | partial [guild](#DOCS_RESOURCES_GUILD/guild-object) object | the guild this template duplicates | | ||
advaith1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| is_dirty | ?boolean | whether the template has unsynced changes | | ||
|
||
###### Example Template Object | ||
|
||
```json | ||
{ | ||
"code": "hgM48av5Q69A", | ||
"name": "Friends & Family", | ||
"description": "", | ||
"usage_count": 49605, | ||
"creator_id": "132837293881950208", | ||
"creator": { | ||
"id": "132837293881950208", | ||
"username": "hoges", | ||
"avatar": "79b0d9f8c340f2d43e1f78b09f175b62", | ||
"discriminator": "0001", | ||
"public_flags": 129 | ||
}, | ||
"created_at": "2020-04-02T21:10:38+00:00", | ||
"updated_at": "2020-05-01T17:57:38+00:00", | ||
"source_guild_id": "678070694164299796", | ||
"serialized_source_guild": { | ||
"name": "Friends & Family", | ||
"description": null, | ||
"region": "us-west", | ||
"verification_level": 0, | ||
"default_message_notifications": 0, | ||
"explicit_content_filter": 0, | ||
"preferred_locale": "en-US", | ||
"afk_timeout": 300, | ||
"roles": [ | ||
{ | ||
"id": 0, | ||
"name": "@everyone", | ||
"permissions": 104324689, | ||
"color": 0, | ||
"hoist": false, | ||
"mentionable": false | ||
} | ||
], | ||
"channels": [ | ||
{ | ||
"name": "Text Channels", | ||
"position": 1, | ||
"topic": null, | ||
"bitrate": 64000, | ||
"user_limit": 0, | ||
"nsfw": false, | ||
"rate_limit_per_user": 0, | ||
"parent_id": null, | ||
"permission_overwrites": [], | ||
"id": 1, | ||
"type": 4 | ||
}, | ||
{ | ||
"name": "general", | ||
"position": 1, | ||
"topic": null, | ||
"bitrate": 64000, | ||
"user_limit": 0, | ||
"nsfw": false, | ||
"rate_limit_per_user": 0, | ||
"parent_id": 1, | ||
"permission_overwrites": [], | ||
"id": 2, | ||
"type": 0 | ||
} | ||
], | ||
"afk_channel_id": null, | ||
"system_channel_id": 2, | ||
"system_channel_flags": 0, | ||
"icon_hash": null | ||
}, | ||
"is_dirty": null | ||
} | ||
``` | ||
|
||
## Get Template % GET /guilds/templates/{template.code#DOCS_RESOURCES_TEMPLATE/template-object} | ||
|
||
Returns a [template](#DOCS_RESOURCES_TEMPLATE/template-object) object for the given code. | ||
|
||
## Create Guild from Template % POST /guilds/templates/{template.code#DOCS_RESOURCES_TEMPLATE/template-object} | ||
|
||
Create a new guild based on a template. Returns a [guild](#DOCS_RESOURCES_GUILD/guild-object) object on success. Fires a [Guild Create](#DOCS_TOPICS_GATEWAY/guild-create) Gateway event. | ||
|
||
> warn | ||
> This endpoint can be used only by bots in less than 10 guilds. | ||
|
||
###### JSON Params | ||
|
||
| Field | Type | Description | | ||
| ----- | ---------------------------------------- | --------------------------------------- | | ||
| name | string | name of the guild (2-100 characters) | | ||
| icon? | [image data](#DOCS_REFERENCE/image-data) | base64 128x128 image for the guild icon | |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.