From 4eb59f8511eb7cdbb8334c41b3788994ffaa8db0 Mon Sep 17 00:00:00 2001 From: ayntee Date: Sun, 28 Mar 2021 16:02:31 +0400 Subject: [PATCH] types(channels): add ModifyChannel and CreateMessage (#697) --- src/types/channels/create_message.ts | 21 ++++++++++++++++++++ src/types/channels/modify_channel.ts | 29 ++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/types/channels/create_message.ts create mode 100644 src/types/channels/modify_channel.ts diff --git a/src/types/channels/create_message.ts b/src/types/channels/create_message.ts new file mode 100644 index 000000000..418142df6 --- /dev/null +++ b/src/types/channels/create_message.ts @@ -0,0 +1,21 @@ +import { Embed } from "../embeds/embed.ts"; +import { AllowedMentions } from "../messages/allowed_mentions.ts"; +import { SnakeCaseProps } from "../util.ts"; + +export interface CreateMessage { + /** The message contents (up to 2000 characters) */ + content?: string; + /** A nonce that can be used for optimistic message sending */ + nonce?: number | string; + /** true if this is a TTS message */ + tts?: boolean; + /** Embedded `rich` content */ + embed?: Embed; + /** Allowed mentions for a message */ + allowedMentions?: AllowedMentions; + /** Include to make your message a reply */ + messageReference?: MessageReference; +} + +/** https://discord.com/developers/docs/resources/channel#create-message */ +export type DiscordCreateMessage = SnakeCaseProps; diff --git a/src/types/channels/modify_channel.ts b/src/types/channels/modify_channel.ts new file mode 100644 index 000000000..4348fc8c6 --- /dev/null +++ b/src/types/channels/modify_channel.ts @@ -0,0 +1,29 @@ +import { SnakeCaseProps } from "../util.ts"; +import { DiscordChannelTypes } from "./channel_types.ts"; +import { Overwrite } from "./overwrite.ts"; + +export interface ModifyChannel { + /** 2-100 character channel name */ + name?: string; + /** The type of channel; only conversion between text and news is supported and only in guilds with the "NEWS" feature */ + type?: DiscordChannelTypes; + /** The position of the channel in the left-hand listing */ + position?: number | null; + /** 0-1024 character channel topic */ + topic?: string | null; + /** Whether the channel is nsfw */ + nsfw?: boolean | null; + /** Amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission `manage_messages` or `manage_channel`, are unaffected */ + rateLimitPerUser?: number | null; + /** The bitrate (in bits) of the voice channel; 8000 to 96000 (128000 for VIP servers) */ + bitrate?: number | null; + /** The user limit of the voice channel; 0 refers to no limit, 1 to 99 refers to a user limit */ + userLimit?: number | null; + /** Channel or category-specific permissions */ + permissionOverwrites?: Overwrite[] | null; + /** id of the new parent category for a channel */ + parentId?: string | null; +} + +/** https://discord.com/developers/docs/resources/channel#modify-channel */ +export type DiscordModifyChannel = SnakeCaseProps;