feat: add sendable embeds (#17)

This commit is contained in:
Zomatree
2022-01-14 22:47:13 +00:00
committed by GitHub
parent 189b4138b8
commit a8090ef798
3 changed files with 43 additions and 6 deletions
+15 -1
View File
@@ -169,7 +169,7 @@ resource('/channels/:channel/messages', {
...channelParams,
...await body("Message to be sent.", schema`
import type { Id, AutumnId } from './_common';
import type { Masquerade } from './Channels';
import type { Masquerade, SendableEmbed } from './Channels';
interface ${'SendMessage'} {
/**
@@ -184,6 +184,13 @@ resource('/channels/:channel/messages', {
*/
attachments?: AutumnId[];
/**
* Embeds to include in the message
* @minLength 1
* @maxLength 10
*/
embeds?: SendableEmbed[];
/**
* Messages to reply to.
*/
@@ -285,6 +292,13 @@ resource('/channels/:channel/messages/:message', {
* @maxLength 2000
*/
content: string;
/**
* Embeds to include in the message.
* @minLength 0
* @maxLength 10
*/
embeds?: SendableEmbed[];
}
`),
...await noContent("Message was changed.")
+26 -1
View File
@@ -1,6 +1,6 @@
import type { Attachment } from "./Autumn"
import type { Id, Nonce } from "./_common"
import type { Embed } from "./January"
import type { JanuaryEmbed } from "./January"
/**
* Saved Messages channel has only one participant, the user who created it.
@@ -226,3 +226,28 @@ export type SystemMessage =
| { type: "channel_renamed"; name: string, by: Id }
| { type: "channel_description_changed"; by: Id }
| { type: "channel_icon_changed"; by: Id };
export type TextEmbed = {
type: "Text",
icon_url?: string,
url?: string,
title?: string,
description?: string,
media?: Attachment,
colour?: string
}
export type Embed = TextEmbed | JanuaryEmbed | { type: "None" }
// better name?
export type SendableEmbed = {
type: "Text",
icon_url?: string,
url?: string,
title?: string,
description?: string,
media?: string,
colour?: string
}
+2 -4
View File
@@ -35,12 +35,10 @@ export type EmbedSpecial = (
)
/**
* Message embed
* Message url embed
*/
export type Embed = (
export type JanuaryEmbed = (
{
type: 'None'
} | {
type: 'Website'
url?: string