diff --git a/assets/openapi.json b/assets/openapi.json index d361c5d..f7bc123 100644 --- a/assets/openapi.json +++ b/assets/openapi.json @@ -2679,12 +2679,20 @@ "items": { "type": "string" } + }, + "discovery_weight": { + "type": "integer" + }, + "discovery_excluded": { + "type": "boolean" } }, "required": [ "bans", "channel_ordering", "channels", + "discovery_excluded", + "discovery_weight", "emojis", "features", "id", @@ -4121,6 +4129,9 @@ "position": { "type": "integer" }, + "invitable": { + "type": "boolean" + }, "permission_overwrites": { "type": "array", "items": { @@ -4148,6 +4159,12 @@ ] } }, + "applied_tags": { + "type": "array", + "items": { + "type": "string" + } + }, "parent_id": { "type": "string" }, @@ -4184,6 +4201,43 @@ }, "locked": { "type": "boolean" + }, + "available_tags": { + "type": "array", + "items": { + "additionalProperties": false, + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "moderated": { + "type": [ + "null", + "boolean" + ] + }, + "emoji_id": { + "type": [ + "null", + "string" + ] + }, + "emoji_name": { + "type": [ + "null", + "string" + ] + }, + "id": { + "type": "string" + } + }, + "required": [ + "id", + "name" + ] + } } } }, @@ -4517,7 +4571,7 @@ "channels": { "type": "array", "items": { - "$ref": "#/components/schemas/ChannelModifySchema" + "$ref": "#/components/schemas/ChannelCreateSchema" } }, "system_channel_id": { @@ -5055,10 +5109,7 @@ "type": "integer" } }, - "additionalProperties": false, - "required": [ - "message_id" - ] + "additionalProperties": false }, "payload_json": { "type": "string" @@ -5281,6 +5332,12 @@ "flags": { "type": "integer" }, + "applied_tags": { + "type": "array", + "items": { + "type": "string" + } + }, "channel_id": { "type": "string" }, @@ -5348,10 +5405,7 @@ "type": "integer" } }, - "additionalProperties": false, - "required": [ - "message_id" - ] + "additionalProperties": false }, "payload_json": { "type": "string" @@ -5434,12 +5488,6 @@ "enforce_nonce": { "type": "boolean" }, - "applied_tags": { - "type": "array", - "items": { - "type": "string" - } - }, "thread_name": { "type": "string" }, @@ -6504,22 +6552,407 @@ "name": { "type": "string" }, - "type": { - "enum": [ - 10, - 11, - 12 - ], - "type": "number" - }, "location": { "type": "string" + }, + "type": { + "type": "integer" } }, "required": [ "name" ] }, + "ApplicationCommandCreateSchema": { + "type": "object", + "properties": { + "type": { + "enum": [ + 1, + 2, + 3, + 4 + ], + "type": "number" + }, + "name": { + "type": "string" + }, + "name_localizations": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "description": { + "type": "string" + }, + "description_localizations": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "options": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ApplicationCommandOption" + } + }, + "default_member_permissions": { + "type": "string" + }, + "dm_permission": { + "type": "boolean" + }, + "nsfw": { + "type": "boolean" + }, + "integration_types": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ApplicationIntegrationType" + } + }, + "contexts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InteractionContextType" + } + }, + "handler": { + "enum": [ + 1, + 2, + 3 + ], + "type": "number" + } + }, + "required": [ + "name" + ] + }, + "BulkApplicationCommandCreateSchema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ApplicationCommandCreateSchema" + } + }, + "ThreadCreationSchema": { + "type": "object", + "properties": { + "auto_archive_duration": { + "type": "integer" + }, + "rate_limit_per_user": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "type": { + "enum": [ + 11, + 12 + ], + "type": "number" + }, + "invitable": { + "type": "boolean" + }, + "applied_tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "location": { + "type": "string" + }, + "message": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "embeds": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Embed" + } + }, + "allowed_mentions": { + "type": "object", + "properties": { + "parse": { + "type": "array", + "items": { + "type": "string" + } + }, + "roles": { + "type": "array", + "items": { + "type": "string" + } + }, + "users": { + "type": "array", + "items": { + "type": "string" + } + }, + "replied_user": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "components": { + "anyOf": [ + { + "type": "array", + "items": { + "$ref": "#/components/schemas/ActionRowComponent" + } + }, + { + "type": "null" + } + ] + }, + "sticker_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "activity": { + "$ref": "#/components/schemas/MessageActivity" + }, + "application_id": { + "type": "string" + }, + "flags": { + "type": "integer" + }, + "attachments": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "filename": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "filename", + "id" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "filename": { + "type": "string" + }, + "uploaded_filename": { + "type": "string" + }, + "original_content_type": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "filename", + "uploaded_filename" + ] + } + ] + } + } + }, + "additionalProperties": false + } + }, + "required": [ + "name" + ] + }, + "PostDataSchema": { + "type": "object", + "properties": { + "thread_ids": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "thread_ids" + ] + }, + "TagCreateSchema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "moderated": { + "type": "boolean", + "nullable": true + }, + "emoji_id": { + "type": "string", + "nullable": true + }, + "emoji_name": { + "type": "string", + "nullable": true + } + }, + "required": [ + "name" + ] + }, + "ChannelCreateSchema": { + "type": "object", + "properties": { + "name": { + "maxLength": 100, + "type": "string" + }, + "type": { + "enum": [ + 0, + 1, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 2, + 255, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "type": "number" + }, + "id": { + "type": "string" + }, + "flags": { + "type": "integer" + }, + "icon": { + "type": "string", + "nullable": true + }, + "parent_id": { + "type": "string" + }, + "default_auto_archive_duration": { + "type": "integer" + }, + "permission_overwrites": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/ChannelPermissionOverwriteType" + }, + "allow": { + "type": "string" + }, + "deny": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "allow", + "deny", + "id", + "type" + ] + } + }, + "video_quality_mode": { + "type": "integer" + }, + "bitrate": { + "type": "integer" + }, + "user_limit": { + "type": "integer" + }, + "nsfw": { + "type": "boolean" + }, + "rate_limit_per_user": { + "type": "integer" + }, + "topic": { + "type": "string" + }, + "default_thread_rate_limit_per_user": { + "type": "integer" + }, + "applied_tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "position": { + "type": "integer" + }, + "invitable": { + "type": "boolean" + }, + "rtc_region": { + "type": "string" + }, + "default_reaction_emoji": { + "type": "string", + "nullable": true + }, + "auto_archive_duration": { + "type": "integer" + }, + "archived": { + "type": "boolean" + }, + "locked": { + "type": "boolean" + } + } + }, "VoiceIdentifySchema": { "type": "object", "properties": { @@ -6673,82 +7106,6 @@ "video_ssrc" ] }, - "ApplicationCommandCreateSchema": { - "type": "object", - "properties": { - "type": { - "enum": [ - 1, - 2, - 3, - 4 - ], - "type": "number" - }, - "name": { - "type": "string" - }, - "name_localizations": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "description": { - "type": "string" - }, - "description_localizations": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "options": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApplicationCommandOption" - } - }, - "default_member_permissions": { - "type": "string" - }, - "dm_permission": { - "type": "boolean" - }, - "nsfw": { - "type": "boolean" - }, - "integration_types": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApplicationIntegrationType" - } - }, - "contexts": { - "type": "array", - "items": { - "$ref": "#/components/schemas/InteractionContextType" - } - }, - "handler": { - "enum": [ - 1, - 2, - 3 - ], - "type": "number" - } - }, - "required": [ - "name" - ] - }, - "BulkApplicationCommandCreateSchema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApplicationCommandCreateSchema" - } - }, "CreateReportSchema": { "type": "object", "properties": { @@ -7266,10 +7623,7 @@ "type": "integer" } }, - "additionalProperties": false, - "required": [ - "message_id" - ] + "additionalProperties": false }, "referenced_message": { "anyOf": [ @@ -7398,6 +7752,12 @@ "$ref": "#/components/schemas/Recipient" } }, + "thread_members": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ThreadMember" + } + }, "last_message_id": { "type": "string" }, @@ -7504,6 +7864,18 @@ "total_message_sent": { "type": "integer" }, + "available_tags": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Tag" + } + }, + "applied_tags": { + "type": "array", + "items": { + "type": "string" + } + }, "position": { "description": "Must be calculated Channel.calculatePosition", "type": "integer" @@ -8696,6 +9068,158 @@ "tag" ] }, + "ThreadMember": { + "type": "object", + "properties": { + "index": { + "type": "string" + }, + "id": { + "type": "string" + }, + "channel": { + "$ref": "#/components/schemas/Channel" + }, + "member_idx": { + "type": "string" + }, + "member": { + "$ref": "#/components/schemas/Member" + }, + "join_timestamp": { + "type": "string", + "format": "date-time" + }, + "muted": { + "type": "boolean" + }, + "mute_config": { + "$ref": "#/components/schemas/ThreadMemberMuteConfig" + }, + "flags": { + "$ref": "#/components/schemas/ThreadMemberFlags" + } + }, + "required": [ + "channel", + "flags", + "id", + "index", + "join_timestamp", + "member", + "member_idx", + "muted" + ] + }, + "Member": { + "type": "object", + "properties": { + "index": { + "type": "string" + }, + "id": { + "type": "string" + }, + "user": { + "$ref": "#/components/schemas/User" + }, + "guild_id": { + "type": "string" + }, + "guild": { + "$ref": "#/components/schemas/Guild" + }, + "nick": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Role" + } + }, + "joined_at": { + "type": "string", + "format": "date-time" + }, + "premium_since": { + "type": "integer" + }, + "deaf": { + "type": "boolean" + }, + "mute": { + "type": "boolean" + }, + "pending": { + "type": "boolean" + }, + "settings": { + "$ref": "#/components/schemas/UserGuildSettings" + }, + "last_message_id": { + "type": "string" + }, + "joined_by": { + "type": "string" + }, + "avatar": { + "type": "string" + }, + "banner": { + "type": "string" + }, + "bio": { + "type": "string" + }, + "theme_colors": { + "type": "array", + "items": { + "type": "integer" + } + }, + "pronouns": { + "type": "string" + }, + "communication_disabled_until": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ] + }, + "avatar_decoration_data": { + "$ref": "#/components/schemas/AvatarDecorationData" + }, + "display_name_styles": { + "$ref": "#/components/schemas/DisplayNameStyle" + }, + "collectibles": { + "$ref": "#/components/schemas/Collectibles" + } + }, + "required": [ + "banner", + "bio", + "communication_disabled_until", + "deaf", + "guild", + "guild_id", + "id", + "index", + "joined_at", + "joined_by", + "mute", + "pending", + "roles", + "settings", + "user" + ] + }, "Guild": { "type": "object", "properties": { @@ -8911,6 +9435,14 @@ "type": "string" } }, + "discovery_weight": { + "type": "integer", + "default": 0 + }, + "discovery_excluded": { + "type": "boolean", + "default": false + }, "id": { "type": "string" } @@ -8919,6 +9451,8 @@ "bans", "channel_ordering", "channels", + "discovery_excluded", + "discovery_weight", "emojis", "features", "id", @@ -8979,115 +9513,6 @@ "user_id" ] }, - "Member": { - "type": "object", - "properties": { - "index": { - "type": "string" - }, - "id": { - "type": "string" - }, - "user": { - "$ref": "#/components/schemas/User" - }, - "guild_id": { - "type": "string" - }, - "guild": { - "$ref": "#/components/schemas/Guild" - }, - "nick": { - "type": "string" - }, - "roles": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Role" - } - }, - "joined_at": { - "type": "string", - "format": "date-time" - }, - "premium_since": { - "type": "integer" - }, - "deaf": { - "type": "boolean" - }, - "mute": { - "type": "boolean" - }, - "pending": { - "type": "boolean" - }, - "settings": { - "$ref": "#/components/schemas/UserGuildSettings" - }, - "last_message_id": { - "type": "string" - }, - "joined_by": { - "type": "string" - }, - "avatar": { - "type": "string" - }, - "banner": { - "type": "string" - }, - "bio": { - "type": "string" - }, - "theme_colors": { - "type": "array", - "items": { - "type": "integer" - } - }, - "pronouns": { - "type": "string" - }, - "communication_disabled_until": { - "anyOf": [ - { - "type": "string", - "format": "date-time" - }, - { - "type": "null" - } - ] - }, - "avatar_decoration_data": { - "$ref": "#/components/schemas/AvatarDecorationData" - }, - "display_name_styles": { - "$ref": "#/components/schemas/DisplayNameStyle" - }, - "collectibles": { - "$ref": "#/components/schemas/Collectibles" - } - }, - "required": [ - "banner", - "bio", - "communication_disabled_until", - "deaf", - "guild", - "guild_id", - "id", - "index", - "joined_at", - "joined_by", - "mute", - "pending", - "roles", - "settings", - "user" - ] - }, "Role": { "type": "object", "properties": { @@ -9181,123 +9606,6 @@ "primary_color" ] }, - "UserGuildSettings": { - "type": "object", - "properties": { - "channel_overrides": { - "anyOf": [ - { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/ChannelOverride" - } - }, - { - "type": "null" - } - ] - }, - "message_notifications": { - "type": "integer" - }, - "mobile_push": { - "type": "boolean" - }, - "mute_config": { - "anyOf": [ - { - "$ref": "#/components/schemas/MuteConfig" - }, - { - "type": "null" - } - ] - }, - "muted": { - "type": "boolean" - }, - "suppress_everyone": { - "type": "boolean" - }, - "suppress_roles": { - "type": "boolean" - }, - "version": { - "type": "integer" - }, - "guild_id": { - "type": "string", - "nullable": true - }, - "flags": { - "type": "integer" - }, - "mute_scheduled_events": { - "type": "boolean" - }, - "hide_muted_channels": { - "type": "boolean" - }, - "notify_highlights": { - "type": "integer", - "const": 0 - } - }, - "required": [ - "channel_overrides", - "flags", - "guild_id", - "hide_muted_channels", - "message_notifications", - "mobile_push", - "mute_config", - "mute_scheduled_events", - "muted", - "notify_highlights", - "suppress_everyone", - "suppress_roles", - "version" - ] - }, - "ChannelOverride": { - "type": "object", - "properties": { - "message_notifications": { - "type": "integer" - }, - "mute_config": { - "$ref": "#/components/schemas/MuteConfig" - }, - "muted": { - "type": "boolean" - }, - "channel_id": { - "type": "string", - "nullable": true - } - }, - "required": [ - "channel_id", - "message_notifications", - "mute_config", - "muted" - ] - }, - "MuteConfig": { - "type": "object", - "properties": { - "end_time": { - "type": "integer" - }, - "selected_time_window": { - "type": "integer" - } - }, - "required": [ - "end_time", - "selected_time_window" - ] - }, "Template": { "type": "object", "properties": { @@ -10034,6 +10342,145 @@ "welcome_channels" ] }, + "UserGuildSettings": { + "type": "object", + "properties": { + "channel_overrides": { + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/ChannelOverride" + } + }, + { + "type": "null" + } + ] + }, + "message_notifications": { + "type": "integer" + }, + "mobile_push": { + "type": "boolean" + }, + "mute_config": { + "anyOf": [ + { + "$ref": "#/components/schemas/MuteConfig" + }, + { + "type": "null" + } + ] + }, + "muted": { + "type": "boolean" + }, + "suppress_everyone": { + "type": "boolean" + }, + "suppress_roles": { + "type": "boolean" + }, + "version": { + "type": "integer" + }, + "guild_id": { + "type": "string", + "nullable": true + }, + "flags": { + "type": "integer" + }, + "mute_scheduled_events": { + "type": "boolean" + }, + "hide_muted_channels": { + "type": "boolean" + }, + "notify_highlights": { + "type": "integer", + "const": 0 + } + }, + "required": [ + "channel_overrides", + "flags", + "guild_id", + "hide_muted_channels", + "message_notifications", + "mobile_push", + "mute_config", + "mute_scheduled_events", + "muted", + "notify_highlights", + "suppress_everyone", + "suppress_roles", + "version" + ] + }, + "ChannelOverride": { + "type": "object", + "properties": { + "message_notifications": { + "type": "integer" + }, + "mute_config": { + "$ref": "#/components/schemas/MuteConfig" + }, + "muted": { + "type": "boolean" + }, + "channel_id": { + "type": "string", + "nullable": true + } + }, + "required": [ + "channel_id", + "message_notifications", + "mute_config", + "muted" + ] + }, + "MuteConfig": { + "type": "object", + "properties": { + "end_time": { + "type": "integer" + }, + "selected_time_window": { + "type": "integer" + } + }, + "required": [ + "end_time", + "selected_time_window" + ] + }, + "ThreadMemberMuteConfig": { + "type": "object", + "properties": { + "end_time": { + "type": "string", + "format": "date-time" + }, + "selected_time_window": { + "type": "integer" + } + } + }, + "ThreadMemberFlags": { + "type": "number", + "enum": [ + 0, + 1, + 2, + 4, + 8 + ] + }, "ChannelPermissionOverwrite": { "type": "object", "properties": { @@ -10146,6 +10593,40 @@ "locked" ] }, + "Tag": { + "type": "object", + "properties": { + "channel_id": { + "type": "string" + }, + "channel": { + "$ref": "#/components/schemas/Channel" + }, + "name": { + "type": "string" + }, + "moderated": { + "type": "boolean", + "default": false + }, + "emoji_id": { + "type": "string" + }, + "emoji_name": { + "type": "string" + }, + "id": { + "type": "string" + } + }, + "required": [ + "channel", + "channel_id", + "id", + "moderated", + "name" + ] + }, "Attachment": { "type": "object", "properties": { @@ -13143,6 +13624,34 @@ "type": "boolean" } } + }, + "MessageActivity": { + "type": "object", + "properties": { + "type": { + "enum": [ + 1, + 3, + 5 + ], + "type": "number" + }, + "session_id": { + "type": "string" + }, + "party_id": { + "type": "string" + }, + "name_override": { + "type": "string" + }, + "icon_override": { + "type": "string" + } + }, + "required": [ + "type" + ] } } }, @@ -21145,7 +21654,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ChannelModifySchema" + "$ref": "#/components/schemas/ChannelCreateSchema" } } } @@ -22600,6 +23109,219 @@ ] } }, + "/channels/{channel_id}/threads/": { + "get": { + "security": [ + { + "bearer": [] + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIMessageArray" + } + } + } + }, + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIErrorResponse" + } + } + } + }, + "403": { + "description": "No description available" + }, + "404": { + "description": "No description available" + } + }, + "parameters": [ + { + "name": "channel_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "channel_id" + }, + { + "name": "around", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "before", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "after", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "schema": { + "type": "number" + }, + "description": "max number of messages to return (1-100). defaults to 50" + } + ], + "tags": [ + "channels" + ] + }, + "post": { + "x-permission-required": "CREATE_PUBLIC_THREADS", + "security": [ + { + "bearer": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ThreadCreationSchema" + } + } + } + }, + "responses": { + "200": { + "description": "No description available" + }, + "403": { + "description": "No description available" + } + }, + "parameters": [ + { + "name": "channel_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "channel_id" + } + ], + "tags": [ + "channels" + ] + } + }, + "/channels/{channel_id}/threads/ack": { + "delete": { + "security": [ + { + "bearer": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AcknowledgeDeleteSchema" + } + } + } + }, + "responses": { + "204": { + "description": "No description available" + } + }, + "parameters": [ + { + "name": "channel_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "channel_id" + } + ], + "tags": [ + "channels" + ] + } + }, + "/channels/{channel_id}/threads/search": { + "get": { + "security": [ + { + "bearer": [] + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GuildMessagesSearchResponse" + } + } + } + }, + "403": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIErrorResponse" + } + } + } + }, + "422": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIErrorResponse" + } + } + } + } + }, + "parameters": [ + { + "name": "channel_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "channel_id" + } + ], + "tags": [ + "channels" + ] + } + }, "/channels/{channel_id}/thread-members/": { "get": { "x-permission-required": "VIEW_CHANNEL", @@ -22744,6 +23466,159 @@ ] } }, + "/channels/{channel_id}/tags/": { + "post": { + "x-permission-required": "MANAGE_CHANNELS", + "security": [ + { + "bearer": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TagCreateSchema" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Channel" + } + } + } + }, + "404": { + "description": "No description available" + } + }, + "parameters": [ + { + "name": "channel_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "channel_id" + } + ], + "tags": [ + "channels" + ] + } + }, + "/channels/{channel_id}/tags/{tag_id}": { + "put": { + "x-permission-required": "MANAGE_CHANNELS", + "security": [ + { + "bearer": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TagCreateSchema" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Channel" + } + } + } + }, + "404": { + "description": "No description available" + } + }, + "parameters": [ + { + "name": "channel_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "channel_id" + }, + { + "name": "tag_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "tag_id" + } + ], + "tags": [ + "channels" + ] + }, + "delete": { + "x-permission-required": "MANAGE_CHANNELS", + "security": [ + { + "bearer": [] + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Channel" + } + } + } + }, + "404": { + "description": "No description available" + } + }, + "parameters": [ + { + "name": "channel_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "channel_id" + }, + { + "name": "tag_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "tag_id" + } + ], + "tags": [ + "channels" + ] + } + }, "/channels/{channel_id}/recipients/{user_id}": { "put": { "security": [ @@ -22866,6 +23741,48 @@ ] } }, + "/channels/{channel_id}/post-data/": { + "post": { + "x-permission-required": "VIEW_CHANNEL", + "security": [ + { + "bearer": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostDataSchema" + } + } + } + }, + "responses": { + "200": { + "description": "No description available" + }, + "403": { + "description": "No description available" + } + }, + "parameters": [ + { + "name": "channel_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "channel_id" + } + ], + "tags": [ + "channels" + ] + } + }, "/channels/{channel_id}/pins/{message_id}": { "put": { "x-permission-required": "VIEW_CHANNEL", @@ -23332,185 +24249,6 @@ ] } }, - "/channels/{channel_id}/messages/": { - "get": { - "security": [ - { - "bearer": [] - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/APIMessageArray" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/APIErrorResponse" - } - } - } - }, - "403": { - "description": "No description available" - }, - "404": { - "description": "No description available" - } - }, - "parameters": [ - { - "name": "channel_id", - "in": "path", - "required": true, - "schema": { - "type": "string" - }, - "description": "channel_id" - }, - { - "name": "around", - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "before", - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "after", - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "limit", - "in": "query", - "schema": { - "type": "number" - }, - "description": "max number of messages to return (1-100). defaults to 50" - } - ], - "tags": [ - "channels" - ] - }, - "post": { - "x-right-required": "SEND_MESSAGES", - "x-permission-required": "SEND_MESSAGES", - "security": [ - { - "bearer": [] - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MessageCreateSchema" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Message" - } - } - } - }, - "400": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/APIErrorResponse" - } - } - } - }, - "403": { - "description": "No description available" - }, - "404": { - "description": "No description available" - } - }, - "parameters": [ - { - "name": "channel_id", - "in": "path", - "required": true, - "schema": { - "type": "string" - }, - "description": "channel_id" - } - ], - "tags": [ - "channels" - ] - } - }, - "/channels/{channel_id}/messages/ack": { - "delete": { - "security": [ - { - "bearer": [] - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AcknowledgeDeleteSchema" - } - } - } - }, - "responses": { - "204": { - "description": "No description available" - } - }, - "parameters": [ - { - "name": "channel_id", - "in": "path", - "required": true, - "schema": { - "type": "string" - }, - "description": "channel_id" - } - ], - "tags": [ - "channels" - ] - } - }, "/channels/{channel_id}/messages/bulk-delete/": { "post": { "security": [ @@ -23567,6 +24305,7 @@ }, "/channels/{channel_id}/messages/{message_id}/threads/": { "post": { + "x-permission-required": "CREATE_PUBLIC_THREADS", "security": [ { "bearer": [] @@ -24539,7 +25278,7 @@ ] }, "patch": { - "x-permission-required": "MANAGE_CHANNELS", + "x-permission-required": "VIEW_CHANNEL", "security": [ { "bearer": [] diff --git a/assets/schemas.json b/assets/schemas.json index b905dc1..3d4b744 100644 --- a/assets/schemas.json +++ b/assets/schemas.json @@ -2813,6 +2813,12 @@ "items": { "type": "string" } + }, + "discovery_weight": { + "type": "integer" + }, + "discovery_excluded": { + "type": "boolean" } }, "additionalProperties": false, @@ -2820,6 +2826,8 @@ "bans", "channel_ordering", "channels", + "discovery_excluded", + "discovery_weight", "emojis", "features", "id", @@ -4366,6 +4374,9 @@ "position": { "type": "integer" }, + "invitable": { + "type": "boolean" + }, "permission_overwrites": { "type": "array", "items": { @@ -4393,6 +4404,12 @@ ] } }, + "applied_tags": { + "type": "array", + "items": { + "type": "string" + } + }, "parent_id": { "type": "string" }, @@ -4431,6 +4448,43 @@ }, "locked": { "type": "boolean" + }, + "available_tags": { + "type": "array", + "items": { + "additionalProperties": false, + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "moderated": { + "type": [ + "null", + "boolean" + ] + }, + "emoji_id": { + "type": [ + "null", + "string" + ] + }, + "emoji_name": { + "type": [ + "null", + "string" + ] + }, + "id": { + "type": "string" + } + }, + "required": [ + "id", + "name" + ] + } } }, "additionalProperties": false, @@ -4795,7 +4849,7 @@ "channels": { "type": "array", "items": { - "$ref": "#/definitions/ChannelModifySchema" + "$ref": "#/definitions/ChannelCreateSchema" } }, "system_channel_id": { @@ -5382,10 +5436,7 @@ "type": "integer" } }, - "additionalProperties": false, - "required": [ - "message_id" - ] + "additionalProperties": false }, "payload_json": { "type": "string" @@ -5614,6 +5665,12 @@ "flags": { "type": "integer" }, + "applied_tags": { + "type": "array", + "items": { + "type": "string" + } + }, "channel_id": { "type": "string" }, @@ -5681,10 +5738,7 @@ "type": "integer" } }, - "additionalProperties": false, - "required": [ - "message_id" - ] + "additionalProperties": false }, "payload_json": { "type": "string" @@ -5767,12 +5821,6 @@ "enforce_nonce": { "type": "boolean" }, - "applied_tags": { - "type": "array", - "items": { - "type": "string" - } - }, "thread_name": { "type": "string" }, @@ -6933,16 +6981,11 @@ "name": { "type": "string" }, - "type": { - "enum": [ - 10, - 11, - 12 - ], - "type": "number" - }, "location": { "type": "string" + }, + "type": { + "type": "integer" } }, "additionalProperties": false, @@ -6951,6 +6994,417 @@ ], "$schema": "http://json-schema.org/draft-07/schema#" }, + "ApplicationCommandCreateSchema": { + "type": "object", + "properties": { + "type": { + "enum": [ + 1, + 2, + 3, + 4 + ], + "type": "number" + }, + "name": { + "type": "string" + }, + "name_localizations": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "description": { + "type": "string" + }, + "description_localizations": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "options": { + "type": "array", + "items": { + "$ref": "#/definitions/ApplicationCommandOption" + } + }, + "default_member_permissions": { + "type": "string" + }, + "dm_permission": { + "type": "boolean" + }, + "nsfw": { + "type": "boolean" + }, + "integration_types": { + "type": "array", + "items": { + "$ref": "#/definitions/ApplicationIntegrationType" + } + }, + "contexts": { + "type": "array", + "items": { + "$ref": "#/definitions/InteractionContextType" + } + }, + "handler": { + "enum": [ + 1, + 2, + 3 + ], + "type": "number" + } + }, + "additionalProperties": false, + "required": [ + "name" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, + "BulkApplicationCommandCreateSchema": { + "type": "array", + "items": { + "$ref": "#/definitions/ApplicationCommandCreateSchema" + }, + "$schema": "http://json-schema.org/draft-07/schema#" + }, + "ThreadCreationSchema": { + "type": "object", + "properties": { + "auto_archive_duration": { + "type": "integer" + }, + "rate_limit_per_user": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "type": { + "enum": [ + 11, + 12 + ], + "type": "number" + }, + "invitable": { + "type": "boolean" + }, + "applied_tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "location": { + "type": "string" + }, + "message": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "embeds": { + "type": "array", + "items": { + "$ref": "#/definitions/Embed" + } + }, + "allowed_mentions": { + "type": "object", + "properties": { + "parse": { + "type": "array", + "items": { + "type": "string" + } + }, + "roles": { + "type": "array", + "items": { + "type": "string" + } + }, + "users": { + "type": "array", + "items": { + "type": "string" + } + }, + "replied_user": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "components": { + "anyOf": [ + { + "type": "array", + "items": { + "$ref": "#/definitions/ActionRowComponent" + } + }, + { + "type": "null" + } + ] + }, + "sticker_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "activity": { + "$ref": "#/definitions/MessageActivity" + }, + "application_id": { + "type": "string" + }, + "flags": { + "type": "integer" + }, + "attachments": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "filename": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "filename", + "id" + ] + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "filename": { + "type": "string" + }, + "uploaded_filename": { + "type": "string" + }, + "original_content_type": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "filename", + "uploaded_filename" + ] + } + ] + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "name" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, + "PostDataSchema": { + "type": "object", + "properties": { + "thread_ids": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "thread_ids" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, + "TagCreateSchema": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "moderated": { + "type": [ + "null", + "boolean" + ] + }, + "emoji_id": { + "type": [ + "null", + "string" + ] + }, + "emoji_name": { + "type": [ + "null", + "string" + ] + } + }, + "additionalProperties": false, + "required": [ + "name" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, + "ChannelCreateSchema": { + "type": "object", + "properties": { + "name": { + "maxLength": 100, + "type": "string" + }, + "type": { + "enum": [ + 0, + 1, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 2, + 255, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "type": "number" + }, + "id": { + "type": "string" + }, + "flags": { + "type": "integer" + }, + "icon": { + "type": [ + "null", + "string" + ] + }, + "parent_id": { + "type": "string" + }, + "default_auto_archive_duration": { + "type": "integer" + }, + "permission_overwrites": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "type": { + "$ref": "#/definitions/ChannelPermissionOverwriteType" + }, + "allow": { + "type": "string" + }, + "deny": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "allow", + "deny", + "id", + "type" + ] + } + }, + "video_quality_mode": { + "type": "integer" + }, + "bitrate": { + "type": "integer" + }, + "user_limit": { + "type": "integer" + }, + "nsfw": { + "type": "boolean" + }, + "rate_limit_per_user": { + "type": "integer" + }, + "topic": { + "type": "string" + }, + "default_thread_rate_limit_per_user": { + "type": "integer" + }, + "applied_tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "position": { + "type": "integer" + }, + "invitable": { + "type": "boolean" + }, + "rtc_region": { + "type": "string" + }, + "default_reaction_emoji": { + "type": [ + "null", + "string" + ] + }, + "auto_archive_duration": { + "type": "integer" + }, + "archived": { + "type": "boolean" + }, + "locked": { + "type": "boolean" + } + }, + "additionalProperties": false, + "$schema": "http://json-schema.org/draft-07/schema#" + }, "VoiceIdentifySchema": { "type": "object", "properties": { @@ -7108,85 +7562,6 @@ ], "$schema": "http://json-schema.org/draft-07/schema#" }, - "ApplicationCommandCreateSchema": { - "type": "object", - "properties": { - "type": { - "enum": [ - 1, - 2, - 3, - 4 - ], - "type": "number" - }, - "name": { - "type": "string" - }, - "name_localizations": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "description": { - "type": "string" - }, - "description_localizations": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "options": { - "type": "array", - "items": { - "$ref": "#/definitions/ApplicationCommandOption" - } - }, - "default_member_permissions": { - "type": "string" - }, - "dm_permission": { - "type": "boolean" - }, - "nsfw": { - "type": "boolean" - }, - "integration_types": { - "type": "array", - "items": { - "$ref": "#/definitions/ApplicationIntegrationType" - } - }, - "contexts": { - "type": "array", - "items": { - "$ref": "#/definitions/InteractionContextType" - } - }, - "handler": { - "enum": [ - 1, - 2, - 3 - ], - "type": "number" - } - }, - "additionalProperties": false, - "required": [ - "name" - ], - "$schema": "http://json-schema.org/draft-07/schema#" - }, - "BulkApplicationCommandCreateSchema": { - "type": "array", - "items": { - "$ref": "#/definitions/ApplicationCommandCreateSchema" - }, - "$schema": "http://json-schema.org/draft-07/schema#" - }, "CreateReportSchema": { "type": "object", "properties": { @@ -7727,10 +8102,7 @@ "type": "integer" } }, - "additionalProperties": false, - "required": [ - "message_id" - ] + "additionalProperties": false }, "referenced_message": { "anyOf": [ @@ -7863,6 +8235,12 @@ "$ref": "#/definitions/Recipient" } }, + "thread_members": { + "type": "array", + "items": { + "$ref": "#/definitions/ThreadMember" + } + }, "last_message_id": { "type": "string" }, @@ -7971,6 +8349,18 @@ "total_message_sent": { "type": "integer" }, + "available_tags": { + "type": "array", + "items": { + "$ref": "#/definitions/Tag" + } + }, + "applied_tags": { + "type": "array", + "items": { + "type": "string" + } + }, "position": { "description": "Must be calculated Channel.calculatePosition", "type": "integer" @@ -9225,6 +9615,162 @@ ], "$schema": "http://json-schema.org/draft-07/schema#" }, + "ThreadMember": { + "type": "object", + "properties": { + "index": { + "type": "string" + }, + "id": { + "type": "string" + }, + "channel": { + "$ref": "#/definitions/Channel" + }, + "member_idx": { + "type": "string" + }, + "member": { + "$ref": "#/definitions/Member" + }, + "join_timestamp": { + "type": "string", + "format": "date-time" + }, + "muted": { + "type": "boolean" + }, + "mute_config": { + "$ref": "#/definitions/ThreadMemberMuteConfig" + }, + "flags": { + "$ref": "#/definitions/ThreadMemberFlags" + } + }, + "additionalProperties": false, + "required": [ + "channel", + "flags", + "id", + "index", + "join_timestamp", + "member", + "member_idx", + "muted" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, + "Member": { + "type": "object", + "properties": { + "index": { + "type": "string" + }, + "id": { + "type": "string" + }, + "user": { + "$ref": "#/definitions/User" + }, + "guild_id": { + "type": "string" + }, + "guild": { + "$ref": "#/definitions/Guild" + }, + "nick": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/Role" + } + }, + "joined_at": { + "type": "string", + "format": "date-time" + }, + "premium_since": { + "type": "integer" + }, + "deaf": { + "type": "boolean" + }, + "mute": { + "type": "boolean" + }, + "pending": { + "type": "boolean" + }, + "settings": { + "$ref": "#/definitions/UserGuildSettings" + }, + "last_message_id": { + "type": "string" + }, + "joined_by": { + "type": "string" + }, + "avatar": { + "type": "string" + }, + "banner": { + "type": "string" + }, + "bio": { + "type": "string" + }, + "theme_colors": { + "type": "array", + "items": { + "type": "integer" + } + }, + "pronouns": { + "type": "string" + }, + "communication_disabled_until": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ] + }, + "avatar_decoration_data": { + "$ref": "#/definitions/AvatarDecorationData" + }, + "display_name_styles": { + "$ref": "#/definitions/DisplayNameStyle" + }, + "collectibles": { + "$ref": "#/definitions/Collectibles" + } + }, + "additionalProperties": false, + "required": [ + "banner", + "bio", + "communication_disabled_until", + "deaf", + "guild", + "guild_id", + "id", + "index", + "joined_at", + "joined_by", + "mute", + "pending", + "roles", + "settings", + "user" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, "Guild": { "type": "object", "properties": { @@ -9448,6 +9994,14 @@ "type": "string" } }, + "discovery_weight": { + "type": "integer", + "default": 0 + }, + "discovery_excluded": { + "type": "boolean", + "default": false + }, "id": { "type": "string" } @@ -9457,6 +10011,8 @@ "bans", "channel_ordering", "channels", + "discovery_excluded", + "discovery_weight", "emojis", "features", "id", @@ -9520,117 +10076,6 @@ ], "$schema": "http://json-schema.org/draft-07/schema#" }, - "Member": { - "type": "object", - "properties": { - "index": { - "type": "string" - }, - "id": { - "type": "string" - }, - "user": { - "$ref": "#/definitions/User" - }, - "guild_id": { - "type": "string" - }, - "guild": { - "$ref": "#/definitions/Guild" - }, - "nick": { - "type": "string" - }, - "roles": { - "type": "array", - "items": { - "$ref": "#/definitions/Role" - } - }, - "joined_at": { - "type": "string", - "format": "date-time" - }, - "premium_since": { - "type": "integer" - }, - "deaf": { - "type": "boolean" - }, - "mute": { - "type": "boolean" - }, - "pending": { - "type": "boolean" - }, - "settings": { - "$ref": "#/definitions/UserGuildSettings" - }, - "last_message_id": { - "type": "string" - }, - "joined_by": { - "type": "string" - }, - "avatar": { - "type": "string" - }, - "banner": { - "type": "string" - }, - "bio": { - "type": "string" - }, - "theme_colors": { - "type": "array", - "items": { - "type": "integer" - } - }, - "pronouns": { - "type": "string" - }, - "communication_disabled_until": { - "anyOf": [ - { - "type": "string", - "format": "date-time" - }, - { - "type": "null" - } - ] - }, - "avatar_decoration_data": { - "$ref": "#/definitions/AvatarDecorationData" - }, - "display_name_styles": { - "$ref": "#/definitions/DisplayNameStyle" - }, - "collectibles": { - "$ref": "#/definitions/Collectibles" - } - }, - "additionalProperties": false, - "required": [ - "banner", - "bio", - "communication_disabled_until", - "deaf", - "guild", - "guild_id", - "id", - "index", - "joined_at", - "joined_by", - "mute", - "pending", - "roles", - "settings", - "user" - ], - "$schema": "http://json-schema.org/draft-07/schema#" - }, "Role": { "type": "object", "properties": { @@ -9728,133 +10173,6 @@ ], "$schema": "http://json-schema.org/draft-07/schema#" }, - "UserGuildSettings": { - "type": "object", - "properties": { - "channel_overrides": { - "anyOf": [ - { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/ChannelOverride" - } - }, - { - "type": "null" - } - ] - }, - "message_notifications": { - "type": "integer" - }, - "mobile_push": { - "type": "boolean" - }, - "mute_config": { - "anyOf": [ - { - "$ref": "#/definitions/MuteConfig" - }, - { - "type": "null" - } - ] - }, - "muted": { - "type": "boolean" - }, - "suppress_everyone": { - "type": "boolean" - }, - "suppress_roles": { - "type": "boolean" - }, - "version": { - "type": "integer" - }, - "guild_id": { - "type": [ - "null", - "string" - ] - }, - "flags": { - "type": "integer" - }, - "mute_scheduled_events": { - "type": "boolean" - }, - "hide_muted_channels": { - "type": "boolean" - }, - "notify_highlights": { - "type": "integer", - "const": 0 - } - }, - "additionalProperties": false, - "required": [ - "channel_overrides", - "flags", - "guild_id", - "hide_muted_channels", - "message_notifications", - "mobile_push", - "mute_config", - "mute_scheduled_events", - "muted", - "notify_highlights", - "suppress_everyone", - "suppress_roles", - "version" - ], - "$schema": "http://json-schema.org/draft-07/schema#" - }, - "ChannelOverride": { - "type": "object", - "properties": { - "message_notifications": { - "type": "integer" - }, - "mute_config": { - "$ref": "#/definitions/MuteConfig" - }, - "muted": { - "type": "boolean" - }, - "channel_id": { - "type": [ - "null", - "string" - ] - } - }, - "additionalProperties": false, - "required": [ - "channel_id", - "message_notifications", - "mute_config", - "muted" - ], - "$schema": "http://json-schema.org/draft-07/schema#" - }, - "MuteConfig": { - "type": "object", - "properties": { - "end_time": { - "type": "integer" - }, - "selected_time_window": { - "type": "integer" - } - }, - "additionalProperties": false, - "required": [ - "end_time", - "selected_time_window" - ], - "$schema": "http://json-schema.org/draft-07/schema#" - }, "Template": { "type": "object", "properties": { @@ -10618,6 +10936,158 @@ ], "$schema": "http://json-schema.org/draft-07/schema#" }, + "UserGuildSettings": { + "type": "object", + "properties": { + "channel_overrides": { + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ChannelOverride" + } + }, + { + "type": "null" + } + ] + }, + "message_notifications": { + "type": "integer" + }, + "mobile_push": { + "type": "boolean" + }, + "mute_config": { + "anyOf": [ + { + "$ref": "#/definitions/MuteConfig" + }, + { + "type": "null" + } + ] + }, + "muted": { + "type": "boolean" + }, + "suppress_everyone": { + "type": "boolean" + }, + "suppress_roles": { + "type": "boolean" + }, + "version": { + "type": "integer" + }, + "guild_id": { + "type": [ + "null", + "string" + ] + }, + "flags": { + "type": "integer" + }, + "mute_scheduled_events": { + "type": "boolean" + }, + "hide_muted_channels": { + "type": "boolean" + }, + "notify_highlights": { + "type": "integer", + "const": 0 + } + }, + "additionalProperties": false, + "required": [ + "channel_overrides", + "flags", + "guild_id", + "hide_muted_channels", + "message_notifications", + "mobile_push", + "mute_config", + "mute_scheduled_events", + "muted", + "notify_highlights", + "suppress_everyone", + "suppress_roles", + "version" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, + "ChannelOverride": { + "type": "object", + "properties": { + "message_notifications": { + "type": "integer" + }, + "mute_config": { + "$ref": "#/definitions/MuteConfig" + }, + "muted": { + "type": "boolean" + }, + "channel_id": { + "type": [ + "null", + "string" + ] + } + }, + "additionalProperties": false, + "required": [ + "channel_id", + "message_notifications", + "mute_config", + "muted" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, + "MuteConfig": { + "type": "object", + "properties": { + "end_time": { + "type": "integer" + }, + "selected_time_window": { + "type": "integer" + } + }, + "additionalProperties": false, + "required": [ + "end_time", + "selected_time_window" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, + "ThreadMemberMuteConfig": { + "type": "object", + "properties": { + "end_time": { + "type": "string", + "format": "date-time" + }, + "selected_time_window": { + "type": "integer" + } + }, + "additionalProperties": false, + "$schema": "http://json-schema.org/draft-07/schema#" + }, + "ThreadMemberFlags": { + "type": "number", + "enum": [ + 0, + 1, + 2, + 4, + 8 + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, "ChannelPermissionOverwrite": { "type": "object", "properties": { @@ -10737,6 +11207,42 @@ ], "$schema": "http://json-schema.org/draft-07/schema#" }, + "Tag": { + "type": "object", + "properties": { + "channel_id": { + "type": "string" + }, + "channel": { + "$ref": "#/definitions/Channel" + }, + "name": { + "type": "string" + }, + "moderated": { + "type": "boolean", + "default": false + }, + "emoji_id": { + "type": "string" + }, + "emoji_name": { + "type": "string" + }, + "id": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "channel", + "channel_id", + "id", + "moderated", + "name" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, "Attachment": { "type": "object", "properties": { @@ -13962,5 +14468,35 @@ }, "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" + }, + "MessageActivity": { + "type": "object", + "properties": { + "type": { + "enum": [ + 1, + 3, + 5 + ], + "type": "number" + }, + "session_id": { + "type": "string" + }, + "party_id": { + "type": "string" + }, + "name_override": { + "type": "string" + }, + "icon_override": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type" + ], + "$schema": "http://json-schema.org/draft-07/schema#" } } \ No newline at end of file diff --git a/src/api/routes/discoverable-guilds.ts b/src/api/routes/discoverable-guilds.ts index 8f059f5..87de37a 100644 --- a/src/api/routes/discoverable-guilds.ts +++ b/src/api/routes/discoverable-guilds.ts @@ -44,31 +44,21 @@ select: { guild_id: true }, }).then((members) => members.map((member) => member.guild_id)) : []; - let guilds; - if (categories == undefined) { - guilds = showAllGuilds - ? await Guild.find({ - take: Math.abs(Number(limit || configLimit)), - }) - : await Guild.find({ - where: { features: Like(`%DISCOVERABLE%`) }, - take: Math.abs(Number(limit || configLimit)), - }); - } else { - guilds = showAllGuilds - ? await Guild.find({ - where: { primary_category_id: categories.toString(), id: Not(In(hiddenGuildIds)) }, - take: Math.abs(Number(limit || configLimit)), - }) - : await Guild.find({ - where: { - primary_category_id: categories.toString(), - features: Like("%DISCOVERABLE%"), - id: Not(In(hiddenGuildIds)), - }, - take: Math.abs(Number(limit || configLimit)), - }); - } + + const guilds = await Guild.find({ + where: { + id: Not(In(hiddenGuildIds)), + discovery_excluded: false, + ...(categories == undefined ? {} : { primary_category_id: categories.toString() }), // TODO: isnt this an array? + ...(showAllGuilds ? {} : { features: Like("%DISCOVERABLE%") }), + }, + order: { + discovery_weight: "DESC", + member_count: "DESC", + }, + skip: Math.abs(Number(offset || Config.get().guild.discovery.offset)), + take: Math.abs(Number(limit || configLimit)), + }); const total = guilds ? guilds.length : undefined; diff --git a/src/util/entities/Guild.ts b/src/util/entities/Guild.ts index 56740ab..aac3daf 100644 --- a/src/util/entities/Guild.ts +++ b/src/util/entities/Guild.ts @@ -298,6 +298,12 @@ @Column({ select: false, type: "simple-array" }) channel_ordering: string[]; + @Column() + discovery_weight: number = 0; + + @Column() + discovery_excluded: boolean = false; + static async createGuild(body: { name?: string; icon?: string | null; diff --git a/src/util/migration/postgres/1770748070808-GuildDiscoveryHoisting.ts b/src/util/migration/postgres/1770748070808-GuildDiscoveryHoisting.ts new file mode 100644 index 0000000..de87838 --- /dev/null +++ b/src/util/migration/postgres/1770748070808-GuildDiscoveryHoisting.ts @@ -0,0 +1,15 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class GuildDiscoveryHoisting1770748070808 implements MigrationInterface { + name = "GuildDiscoveryHoisting1770748070808"; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "guilds" ADD "discovery_weight" integer NOT NULL`); + await queryRunner.query(`ALTER TABLE "guilds" ADD "discovery_excluded" boolean NOT NULL`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "guilds" DROP COLUMN "discovery_excluded"`); + await queryRunner.query(`ALTER TABLE "guilds" DROP COLUMN "discovery_weight"`); + } +}