Add MessageSendSchema

This commit is contained in:
bitfl0wer 2023-05-05 21:52:27 +02:00
parent a706341e36
commit abd555dfac
1 changed files with 23 additions and 1 deletions

View File

@ -1,8 +1,12 @@
use std::{collections::HashMap, io::Bytes};
use regex::Regex; use regex::Regex;
use serde::{Deserialize, Serialize}; use serde::{ser::SerializeMap, Deserialize, Serialize, Serializer};
use crate::errors::FieldFormatError; use crate::errors::FieldFormatError;
use super::{DiscordFileAttachment, Embed};
/** /**
A struct that represents a well-formed email address. A struct that represents a well-formed email address.
*/ */
@ -240,6 +244,24 @@ pub struct TotpSchema {
login_source: Option<String>, login_source: Option<String>,
} }
#[derive(Debug, Deserialize)]
#[serde(rename_all = "snake_case")]
pub struct MessageSendSchema {
#[serde(rename = "type")]
message_type: i32,
content: Option<String>,
nonce: Option<String>,
tts: Option<bool>,
embeds: Option<Vec<super::Embed>>,
allowed_mentions: Option<super::AllowedMention>,
message_reference: Option<super::MessageReference>,
components: Option<Vec<super::Component>>,
sticker_ids: Option<Vec<String>>,
#[serde(flatten)]
files: Option<HashMap<String, Vec<u8>>>,
attachments: Option<Vec<super::PartialDiscordFileAttachment>>,
}
// I know that some of these tests are... really really basic and unneccessary, but sometimes, I // I know that some of these tests are... really really basic and unneccessary, but sometimes, I
// just feel like writing tests, so there you go :) -@bitfl0wer // just feel like writing tests, so there you go :) -@bitfl0wer
#[cfg(test)] #[cfg(test)]