mirror of
https://github.com/stoatchat/javascript-client-api.git
synced 2026-07-18 16:14:27 -04:00
feat: add sendable embeds (#17)
This commit is contained in:
+15
-1
@@ -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
@@ -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
@@ -35,12 +35,10 @@ export type EmbedSpecial = (
|
||||
)
|
||||
|
||||
/**
|
||||
* Message embed
|
||||
* Message url embed
|
||||
*/
|
||||
export type Embed = (
|
||||
export type JanuaryEmbed = (
|
||||
{
|
||||
type: 'None'
|
||||
} | {
|
||||
type: 'Website'
|
||||
|
||||
url?: string
|
||||
|
||||
Reference in New Issue
Block a user