Add DiscordFileAttachment, change visibilities
This commit is contained in:
parent
abd555dfac
commit
9b5caf6392
|
@ -216,7 +216,7 @@ pub struct Message {
|
||||||
mentions: Vec<UserObject>,
|
mentions: Vec<UserObject>,
|
||||||
mention_roles: Vec<String>,
|
mention_roles: Vec<String>,
|
||||||
mention_channels: Option<Vec<ChannelMention>>,
|
mention_channels: Option<Vec<ChannelMention>>,
|
||||||
attachments: Vec<Attachment>,
|
pub attachments: Vec<Attachment>,
|
||||||
embeds: Vec<Embed>,
|
embeds: Vec<Embed>,
|
||||||
reactions: Option<Vec<Reaction>>,
|
reactions: Option<Vec<Reaction>>,
|
||||||
nonce: Option<serde_json::Value>,
|
nonce: Option<serde_json::Value>,
|
||||||
|
@ -386,7 +386,7 @@ struct Attachment {
|
||||||
/**
|
/**
|
||||||
Represents an Embed. [See the Discord Documentation](https://discord.com/developers/docs/resources/channel#embed-object).
|
Represents an Embed. [See the Discord Documentation](https://discord.com/developers/docs/resources/channel#embed-object).
|
||||||
*/
|
*/
|
||||||
struct Embed {
|
pub struct Embed {
|
||||||
title: Option<String>,
|
title: Option<String>,
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
embed_type: Option<String>,
|
embed_type: Option<String>,
|
||||||
|
@ -539,9 +539,9 @@ struct InstallParams {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
struct MessageReference {
|
pub struct MessageReference {
|
||||||
message_id: Option<String>,
|
message_id: String,
|
||||||
channel_id: Option<String>,
|
channel_id: String,
|
||||||
guild_id: Option<String>,
|
guild_id: Option<String>,
|
||||||
fail_if_not_exists: Option<bool>,
|
fail_if_not_exists: Option<bool>,
|
||||||
}
|
}
|
||||||
|
@ -655,7 +655,7 @@ struct DefaultReaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
enum Component {
|
pub enum Component {
|
||||||
ActionRow = 1,
|
ActionRow = 1,
|
||||||
Button = 2,
|
Button = 2,
|
||||||
StringSelect = 3,
|
StringSelect = 3,
|
||||||
|
@ -842,32 +842,51 @@ pub struct GatewayPayload {
|
||||||
|
|
||||||
impl WebSocketEvent for GatewayPayload {}
|
impl WebSocketEvent for GatewayPayload {}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct DiscordFileAttachment {
|
pub struct DiscordFileAttachment {
|
||||||
pub name: i16,
|
pub id: i16,
|
||||||
pub filename: String,
|
pub filename: String,
|
||||||
pub file: File,
|
description: Option<String>,
|
||||||
|
content_type: Option<String>,
|
||||||
|
size: i64,
|
||||||
|
url: String,
|
||||||
|
proxy_url: String,
|
||||||
|
height: Option<i32>,
|
||||||
|
width: Option<i32>,
|
||||||
|
ephemeral: Option<bool>,
|
||||||
|
duration_secs: Option<f32>,
|
||||||
|
waveform: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DiscordFileAttachment {
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
/**
|
|
||||||
Returns a [`Vec<DiscordFileAttachment>`], where [`DiscordFileAttachment`] represents a file
|
pub struct PartialDiscordFileAttachment {
|
||||||
attachment according to Discord API spec (Unique name, filename and File).
|
pub id: Option<i16>,
|
||||||
# Arguments
|
pub filename: Option<String>,
|
||||||
* filename_file_map: A [`Vec<String, File>`], where
|
description: Option<String>,
|
||||||
* [`String`]: Filename of the file
|
content_type: Option<String>,
|
||||||
* [`File`]: A [`File`] object.
|
size: Option<i64>,
|
||||||
*/
|
url: Option<String>,
|
||||||
pub fn new(filename_file_vec: Vec<(String, File)>) -> Vec<DiscordFileAttachment> {
|
proxy_url: Option<String>,
|
||||||
let mut return_vec: Vec<DiscordFileAttachment> = Vec::new();
|
height: Option<i32>,
|
||||||
let mut counter = 0;
|
width: Option<i32>,
|
||||||
for (filename, file) in filename_file_vec {
|
ephemeral: Option<bool>,
|
||||||
return_vec.push(DiscordFileAttachment {
|
duration_secs: Option<f32>,
|
||||||
name: counter,
|
waveform: Option<String>,
|
||||||
filename,
|
}
|
||||||
file,
|
|
||||||
});
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
counter += 1;
|
pub struct AllowedMention {
|
||||||
}
|
parse: Vec<AllowedMentionType>,
|
||||||
return_vec
|
roles: Vec<String>,
|
||||||
}
|
users: Vec<String>,
|
||||||
|
replied_user: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum AllowedMentionType {
|
||||||
|
Roles,
|
||||||
|
Users,
|
||||||
|
Everyone,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue