Make MessageSendSchema fields public
This commit is contained in:
parent
208eeac536
commit
f0241e0756
|
@ -8,42 +8,14 @@ use crate::types::entities::{
|
|||
#[serde(rename_all = "snake_case")]
|
||||
pub struct MessageSendSchema {
|
||||
#[serde(rename = "type")]
|
||||
message_type: Option<i32>,
|
||||
content: Option<String>,
|
||||
nonce: Option<String>,
|
||||
tts: Option<bool>,
|
||||
embeds: Option<Vec<Embed>>,
|
||||
allowed_mentions: Option<AllowedMention>,
|
||||
message_reference: Option<MessageReference>,
|
||||
components: Option<Vec<Component>>,
|
||||
sticker_ids: Option<Vec<String>>,
|
||||
pub message_type: Option<i32>,
|
||||
pub content: Option<String>,
|
||||
pub nonce: Option<String>,
|
||||
pub tts: Option<bool>,
|
||||
pub embeds: Option<Vec<Embed>>,
|
||||
pub allowed_mentions: Option<AllowedMention>,
|
||||
pub message_reference: Option<MessageReference>,
|
||||
pub components: Option<Vec<Component>>,
|
||||
pub sticker_ids: Option<Vec<String>>,
|
||||
pub attachments: Option<Vec<PartialDiscordFileAttachment>>,
|
||||
}
|
||||
|
||||
impl MessageSendSchema {
|
||||
pub fn new(
|
||||
message_type: Option<i32>,
|
||||
content: Option<String>,
|
||||
nonce: Option<String>,
|
||||
tts: Option<bool>,
|
||||
embeds: Option<Vec<Embed>>,
|
||||
allowed_mentions: Option<AllowedMention>,
|
||||
message_reference: Option<MessageReference>,
|
||||
components: Option<Vec<Component>>,
|
||||
sticker_ids: Option<Vec<String>>,
|
||||
attachments: Option<Vec<PartialDiscordFileAttachment>>,
|
||||
) -> MessageSendSchema {
|
||||
MessageSendSchema {
|
||||
message_type,
|
||||
content,
|
||||
nonce,
|
||||
tts,
|
||||
embeds,
|
||||
allowed_mentions,
|
||||
message_reference,
|
||||
components,
|
||||
sticker_ids,
|
||||
attachments,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,18 +8,10 @@ mod common;
|
|||
#[tokio::test]
|
||||
async fn send_message() {
|
||||
let mut bundle = common::setup().await;
|
||||
let mut message = types::MessageSendSchema::new(
|
||||
None,
|
||||
Some("A Message!".to_string()),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
);
|
||||
let mut message = types::MessageSendSchema {
|
||||
content: Some("A Message!".to_string()),
|
||||
..Default::default()
|
||||
};
|
||||
let _ = bundle
|
||||
.user
|
||||
.send_message(&mut message, bundle.channel.id.to_string(), None)
|
||||
|
@ -53,18 +45,11 @@ async fn send_message_attachment() {
|
|||
content: buffer,
|
||||
};
|
||||
|
||||
let mut message = types::MessageSendSchema::new(
|
||||
None,
|
||||
Some("trans rights now".to_string()),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Some(vec![attachment.clone()]),
|
||||
);
|
||||
let mut message = types::MessageSendSchema {
|
||||
content: Some("trans rights now".to_string()),
|
||||
attachments: Some(vec![attachment.clone()]),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let vec_attach = vec![attachment.clone()];
|
||||
let _arg = Some(&vec_attach);
|
||||
|
|
Loading…
Reference in New Issue