polyphony_types/schema/
message.rs1use serde::{Deserialize, Serialize};
2use crate::entities::{AllowedMention, Component, Embed, MessageReference, PartialDiscordFileAttachment};
3
4#[derive(Debug, Deserialize, Serialize)]
5#[serde(rename_all = "snake_case")]
6pub struct MessageSendSchema {
7 #[serde(rename = "type")]
8 message_type: Option<i32>,
9 content: Option<String>,
10 nonce: Option<String>,
11 tts: Option<bool>,
12 embeds: Option<Vec<Embed>>,
13 allowed_mentions: Option<AllowedMention>,
14 message_reference: Option<MessageReference>,
15 components: Option<Vec<Component>>,
16 sticker_ids: Option<Vec<String>>,
17 pub attachments: Option<Vec<PartialDiscordFileAttachment>>,
18}
19
20impl MessageSendSchema {
22 pub fn new(
23 message_type: Option<i32>,
24 content: Option<String>,
25 nonce: Option<String>,
26 tts: Option<bool>,
27 embeds: Option<Vec<Embed>>,
28 allowed_mentions: Option<AllowedMention>,
29 message_reference: Option<MessageReference>,
30 components: Option<Vec<Component>>,
31 sticker_ids: Option<Vec<String>>,
32 attachments: Option<Vec<PartialDiscordFileAttachment>>,
33 ) -> MessageSendSchema {
34 MessageSendSchema {
35 message_type,
36 content,
37 nonce,
38 tts,
39 embeds,
40 allowed_mentions,
41 message_reference,
42 components,
43 sticker_ids,
44 attachments,
45 }
46 }
47}