Compare commits
No commits in common. "a8b747f1ef4b9e85bbdd252f3ba0878b2d221dcf" and "ce67efe93cf5fa31edcf85c555c1fdbd7bdf2863" have entirely different histories.
a8b747f1ef
...
ce67efe93c
|
@ -2314,8 +2314,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-pg-uint"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/bitfl0wer/sqlx-pg-uint#a132f4ad12f6cd1f68cc07e01edd644b4735e346"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "252a4a55217704777814f5be098ab5563d1e21c7f0d3010a301f75373d68c8e2"
|
||||
dependencies = [
|
||||
"bigdecimal",
|
||||
"serde",
|
||||
|
@ -2326,8 +2327,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-pg-uint-macros"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/bitfl0wer/sqlx-pg-uint#a132f4ad12f6cd1f68cc07e01edd644b4735e346"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe4f5704fe7b866782ab87d9fe069c2f02be27b801e990af56a3d94a29290bd8"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.75",
|
||||
|
|
|
@ -67,9 +67,7 @@ rand = "0.8.5"
|
|||
flate2 = { version = "1.0.30", optional = true }
|
||||
webpki-roots = "0.26.3"
|
||||
pubserve = { version = "1.1.0", features = ["async", "send"] }
|
||||
sqlx-pg-uint = { git = "https://github.com/bitfl0wer/sqlx-pg-uint", features = [
|
||||
"serde",
|
||||
], optional = true }
|
||||
sqlx-pg-uint = { version = "0.2.0", optional = true }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
rustls = "0.21.12"
|
||||
|
|
|
@ -40,7 +40,7 @@ impl Message {
|
|||
chorus_request.deserialize_response::<Message>(user).await
|
||||
} else {
|
||||
for (index, attachment) in message.attachments.iter_mut().enumerate() {
|
||||
attachment.get_mut(index).unwrap().id = Some((index as u64).into());
|
||||
attachment.get_mut(index).unwrap().id = Some(index as i16);
|
||||
}
|
||||
let mut form = reqwest::multipart::Form::new();
|
||||
let payload_json = to_string(&message).unwrap();
|
||||
|
|
|
@ -224,8 +224,7 @@ pub struct ApplicationCommandOptionChoice {
|
|||
|
||||
#[derive(Debug, Clone, Copy, Serialize_repr, Deserialize_repr, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(i32)]
|
||||
/// # Reference
|
||||
/// See <https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types>
|
||||
pub enum ApplicationCommandOptionType {
|
||||
|
@ -295,8 +294,7 @@ pub struct ApplicationCommandPermission {
|
|||
Ord,
|
||||
)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
/// See <https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type>
|
||||
pub enum ApplicationCommandPermissionType {
|
||||
#[default]
|
||||
|
|
|
@ -48,10 +48,7 @@ pub struct Attachment {
|
|||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||
pub struct PartialDiscordFileAttachment {
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub id: Option<u64>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub id: Option<PgU64>,
|
||||
pub id: Option<i16>,
|
||||
pub filename: String,
|
||||
/// Max 1024 characters
|
||||
pub description: Option<String>,
|
||||
|
|
|
@ -110,8 +110,7 @@ pub struct AuditLogChange {
|
|||
PartialOrd,
|
||||
Ord,
|
||||
)]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
/// # Reference:
|
||||
/// See <https://docs.discord.sex/resources/audit-log#audit-log-events>
|
||||
|
|
|
@ -32,8 +32,7 @@ pub struct AutoModerationRule {
|
|||
}
|
||||
|
||||
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default, Copy)]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
/// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types>
|
||||
pub enum AutoModerationRuleEventType {
|
||||
|
@ -44,8 +43,7 @@ pub enum AutoModerationRuleEventType {
|
|||
#[derive(
|
||||
Serialize_repr, Deserialize_repr, Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Copy,
|
||||
)]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
/// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types>
|
||||
pub enum AutoModerationRuleTriggerType {
|
||||
|
@ -82,22 +80,18 @@ pub struct AutoModerationRuleTriggerMetadataForKeywordPreset {
|
|||
pub allow_list: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Copy)]
|
||||
/// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata>
|
||||
pub struct AutoModerationRuleTriggerMetadataForMentionSpam {
|
||||
/// Max 50
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub mention_total_limit: u8,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub mention_total_limit: sqlx_pg_uint::PgU8,
|
||||
pub mention_raid_protection_enabled: bool,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Serialize_repr, Deserialize_repr, Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Copy,
|
||||
)]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
/// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types>
|
||||
pub enum AutoModerationRuleKeywordPresetType {
|
||||
|
@ -116,20 +110,9 @@ pub struct AutoModerationAction {
|
|||
}
|
||||
|
||||
#[derive(
|
||||
Serialize_repr,
|
||||
Deserialize_repr,
|
||||
Debug,
|
||||
Clone,
|
||||
Default,
|
||||
PartialEq,
|
||||
Eq,
|
||||
PartialOrd,
|
||||
Ord,
|
||||
Copy,
|
||||
Hash,
|
||||
Serialize_repr, Deserialize_repr, Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Copy, Hash
|
||||
)]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
/// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types>
|
||||
pub enum AutoModerationActionType {
|
||||
|
|
|
@ -194,8 +194,7 @@ pub struct PermissionOverwrite {
|
|||
}
|
||||
|
||||
#[derive(Debug, Serialize_repr, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy)]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
/// # Reference
|
||||
///
|
||||
/// See <https://docs.discord.sex/resources/channel#permission-overwrite-type>
|
||||
|
|
|
@ -32,6 +32,9 @@ use super::option_arc_rwlock_ptr_eq;
|
|||
pub struct Emoji {
|
||||
pub id: Snowflake,
|
||||
pub name: Option<String>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub roles: Option<sqlx::types::Json<Vec<Snowflake>>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub roles: Option<Vec<Snowflake>>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub user: Option<Shared<User>>,
|
||||
|
|
|
@ -303,8 +303,7 @@ impl PartialEq for GuildScheduledEvent {
|
|||
}
|
||||
|
||||
#[derive(Serialize_repr, Deserialize_repr, Debug, Default, Clone, PartialEq, Copy)]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
/// See <https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level>
|
||||
pub enum GuildScheduledEventPrivacyLevel {
|
||||
#[default]
|
||||
|
@ -312,8 +311,7 @@ pub enum GuildScheduledEventPrivacyLevel {
|
|||
}
|
||||
|
||||
#[derive(Serialize_repr, Deserialize_repr, Debug, Default, Clone, PartialEq, Copy)]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
/// See <https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status>
|
||||
pub enum GuildScheduledEventStatus {
|
||||
#[default]
|
||||
|
@ -336,8 +334,7 @@ pub enum GuildScheduledEventStatus {
|
|||
Copy,
|
||||
Hash,
|
||||
)]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
/// See <https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types>
|
||||
pub enum GuildScheduledEventEntityType {
|
||||
#[default]
|
||||
|
@ -375,8 +372,7 @@ pub struct VoiceRegion {
|
|||
Ord,
|
||||
)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
/// See <https://discord-userdoccers.vercel.app/resources/guild#message-notification-level>
|
||||
pub enum MessageNotificationLevel {
|
||||
|
@ -399,8 +395,7 @@ pub enum MessageNotificationLevel {
|
|||
Ord,
|
||||
)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
/// See <https://discord-userdoccers.vercel.app/resources/guild#explicit-content-filter-level>
|
||||
pub enum ExplicitContentFilterLevel {
|
||||
|
@ -424,8 +419,7 @@ pub enum ExplicitContentFilterLevel {
|
|||
Ord,
|
||||
)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
/// See <https://discord-userdoccers.vercel.app/resources/guild#verification-level>
|
||||
pub enum VerificationLevel {
|
||||
|
@ -451,8 +445,7 @@ pub enum VerificationLevel {
|
|||
Ord,
|
||||
)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
/// See <https://discord-userdoccers.vercel.app/resources/guild#verification-level>
|
||||
pub enum MFALevel {
|
||||
|
@ -475,8 +468,7 @@ pub enum MFALevel {
|
|||
Ord,
|
||||
)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
/// See <https://discord-userdoccers.vercel.app/resources/guild#verification-level>
|
||||
pub enum NSFWLevel {
|
||||
|
@ -501,8 +493,7 @@ pub enum NSFWLevel {
|
|||
Ord,
|
||||
)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
/// See <https://discord-userdoccers.vercel.app/resources/guild#verification-level>
|
||||
pub enum PremiumTier {
|
||||
|
|
|
@ -23,14 +23,8 @@ pub struct Integration {
|
|||
pub syncing: Option<bool>,
|
||||
pub role_id: Option<String>,
|
||||
pub enabled_emoticons: Option<bool>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub expire_behaviour: Option<u8>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub expire_behaviour: Option<sqlx_pg_uint::PgU8>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub expire_grace_period: Option<u16>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub expire_grace_period: Option<sqlx_pg_uint::PgU16>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub user: Option<Shared<User>>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
|
|
|
@ -5,11 +5,8 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::{Snowflake, WelcomeScreenObject, Shared, InviteFlags, InviteType, InviteTargetType, Guild, VerificationLevel};
|
||||
use crate::types::types::guild_configuration::GuildFeaturesList;
|
||||
use crate::types::{
|
||||
Guild, InviteFlags, InviteTargetType, InviteType, Shared, Snowflake, VerificationLevel,
|
||||
WelcomeScreenObject,
|
||||
};
|
||||
|
||||
use super::guild::GuildScheduledEvent;
|
||||
use super::{Application, Channel, GuildMember, NSFWLevel, User};
|
||||
|
@ -39,14 +36,8 @@ pub struct Invite {
|
|||
pub invite_type: Option<InviteType>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub inviter: Option<User>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub max_age: Option<u32>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub max_age: Option<sqlx_pg_uint::PgU32>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub max_uses: Option<u8>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub max_uses: Option<sqlx_pg_uint::PgU8>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub stage_instance: Option<InviteStageInstance>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
|
@ -56,10 +47,7 @@ pub struct Invite {
|
|||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub target_user: Option<User>,
|
||||
pub temporary: Option<bool>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub uses: Option<u32>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub uses: Option<sqlx_pg_uint::PgU32>,
|
||||
}
|
||||
|
||||
/// The guild an invite is for.
|
||||
|
|
|
@ -150,10 +150,7 @@ pub enum MessageReferenceType {
|
|||
pub struct MessageInteraction {
|
||||
pub id: Snowflake,
|
||||
#[serde(rename = "type")]
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub interaction_type: u8,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub interaction_type: sqlx_pg_uint::PgU8,
|
||||
pub name: String,
|
||||
pub user: User,
|
||||
pub member: Option<Shared<GuildMember>>,
|
||||
|
@ -285,14 +282,8 @@ pub struct EmbedField {
|
|||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub struct Reaction {
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub count: u32,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub count: sqlx_pg_uint::PgU32,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub burst_count: u32,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub burst_count: sqlx_pg_uint::PgU32,
|
||||
#[serde(default)]
|
||||
pub me: bool,
|
||||
#[serde(default)]
|
||||
|
@ -305,8 +296,6 @@ pub struct Reaction {
|
|||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Copy, Serialize, Deserialize, Eq, PartialOrd, Ord)]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
pub enum Component {
|
||||
ActionRow = 1,
|
||||
Button = 2,
|
||||
|
@ -331,8 +320,7 @@ pub struct MessageActivity {
|
|||
Debug, Default, PartialEq, Clone, Copy, Serialize_repr, Deserialize_repr, Eq, PartialOrd, Ord,
|
||||
)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
/// # Reference
|
||||
/// See <https://docs.discord.sex/resources/message#message-type>
|
||||
|
@ -476,8 +464,7 @@ pub struct PartialEmoji {
|
|||
#[derive(Debug, PartialEq, Clone, Copy, Serialize, Deserialize, PartialOrd, Ord, Eq, Hash)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
pub enum ReactionType {
|
||||
Normal = 0,
|
||||
Burst = 1, // The dreaded super reactions
|
||||
|
|
|
@ -45,8 +45,7 @@ impl PartialEq for Relationship {
|
|||
Copy,
|
||||
Hash,
|
||||
)]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
/// See <https://discord-userdoccers.vercel.app/resources/user#relationship-type>
|
||||
pub enum RelationshipType {
|
||||
Suggestion = 6,
|
||||
|
|
|
@ -32,10 +32,7 @@ pub struct RoleObject {
|
|||
pub hoist: bool,
|
||||
pub icon: Option<String>,
|
||||
pub unicode_emoji: Option<String>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub position: u16,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub position: sqlx_pg_uint::PgU16,
|
||||
#[serde(default)]
|
||||
pub permissions: PermissionFlags,
|
||||
pub managed: bool,
|
||||
|
@ -50,16 +47,11 @@ pub struct RoleObject {
|
|||
pub struct RoleSubscriptionData {
|
||||
pub role_subscription_listing_id: Snowflake,
|
||||
pub tier_name: String,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub total_months_subscribed: u32,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub total_months_subscribed: sqlx_pg_uint::PgU32,
|
||||
pub is_renewal: bool,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, Hash, Copy, PartialOrd, Ord,
|
||||
)]
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, Hash, Copy, PartialOrd, Ord)]
|
||||
/// See <https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure>
|
||||
pub struct RoleTags {
|
||||
#[serde(default)]
|
||||
|
|
|
@ -21,11 +21,8 @@ pub struct StageInstance {
|
|||
pub guild_scheduled_event_id: Option<Snowflake>,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Serialize_repr, Deserialize_repr, Debug, Clone, Default, Copy, PartialEq, Eq, PartialOrd, Ord,
|
||||
)]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[repr(u8)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
/// See <https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level>
|
||||
pub enum StageInstancePrivacyLevel {
|
||||
|
|
|
@ -77,8 +77,7 @@ pub struct StickerItem {
|
|||
#[derive(
|
||||
Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Hash, Serialize_repr, Deserialize_repr,
|
||||
)]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
#[serde(rename = "SCREAMING_SNAKE_CASE")]
|
||||
/// # Reference
|
||||
|
@ -94,8 +93,7 @@ pub enum StickerType {
|
|||
#[derive(
|
||||
Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Hash, Serialize_repr, Deserialize_repr,
|
||||
)]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
/// # Reference
|
||||
/// See <https://docs.discord.sex/resources/sticker#sticker-format-types>
|
||||
|
|
|
@ -34,10 +34,7 @@ impl PartialEq for Team {
|
|||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct TeamMember {
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub membership_state: u8,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub membership_state: sqlx_pg_uint::PgU8,
|
||||
pub permissions: Vec<String>,
|
||||
pub team_id: Snowflake,
|
||||
pub user: Shared<User>,
|
||||
|
|
|
@ -47,10 +47,7 @@ pub struct User {
|
|||
pub bot: Option<bool>,
|
||||
pub system: Option<bool>,
|
||||
pub mfa_enabled: Option<bool>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub accent_color: Option<u32>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub accent_color: Option<sqlx_pg_uint::PgU32>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(default))]
|
||||
pub locale: Option<String>,
|
||||
pub verified: Option<bool>,
|
||||
|
@ -61,10 +58,7 @@ pub struct User {
|
|||
#[serde(deserialize_with = "deserialize_option_number_from_string")]
|
||||
pub flags: Option<UserFlags>,
|
||||
pub premium_since: Option<DateTime<Utc>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub premium_type: Option<u8>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub premium_type: Option<sqlx_pg_uint::PgU8>,
|
||||
pub pronouns: Option<String>,
|
||||
pub public_flags: Option<UserFlags>,
|
||||
pub banner: Option<String>,
|
||||
|
@ -150,19 +144,13 @@ pub struct PublicUser {
|
|||
pub username: Option<String>,
|
||||
pub discriminator: Option<String>,
|
||||
pub avatar: Option<String>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub accent_color: Option<u32>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub accent_color: Option<sqlx_pg_uint::PgU32>,
|
||||
pub banner: Option<String>,
|
||||
pub theme_colors: Option<ThemeColors>,
|
||||
pub pronouns: Option<String>,
|
||||
pub bot: Option<bool>,
|
||||
pub bio: Option<String>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub premium_type: Option<u8>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub premium_type: Option<sqlx_pg_uint::PgU8>,
|
||||
pub premium_since: Option<DateTime<Utc>>,
|
||||
pub public_flags: Option<UserFlags>,
|
||||
}
|
||||
|
|
|
@ -42,16 +42,10 @@ pub enum UserTheme {
|
|||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
pub struct UserSettings {
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub afk_timeout: Option<u16>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub afk_timeout: Option<sqlx_pg_uint::PgU16>,
|
||||
pub allow_accessibility_detection: bool,
|
||||
pub animate_emoji: bool,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub animate_stickers: u8,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub animate_stickers: sqlx_pg_uint::PgU8,
|
||||
pub contact_sync_enabled: bool,
|
||||
pub convert_emoticons: bool,
|
||||
pub custom_status: Option<CustomStatus>,
|
||||
|
@ -60,10 +54,7 @@ pub struct UserSettings {
|
|||
pub developer_mode: bool,
|
||||
pub disable_games_tab: bool,
|
||||
pub enable_tts_command: bool,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub explicit_content_filter: u8,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub explicit_content_filter: sqlx_pg_uint::PgU8,
|
||||
pub friend_source_flags: FriendSourceFlags,
|
||||
pub gateway_connected: Option<bool>,
|
||||
pub gif_auto_play: bool,
|
||||
|
@ -88,13 +79,10 @@ pub struct UserSettings {
|
|||
impl Default for UserSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
afk_timeout: Some(3600.into()),
|
||||
afk_timeout: Some(3600),
|
||||
allow_accessibility_detection: true,
|
||||
animate_emoji: true,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
animate_stickers: 0,
|
||||
#[cfg(feature = "sqlx")]
|
||||
animate_stickers: 0.into(),
|
||||
contact_sync_enabled: false,
|
||||
convert_emoticons: false,
|
||||
custom_status: None,
|
||||
|
@ -103,10 +91,7 @@ impl Default for UserSettings {
|
|||
developer_mode: true,
|
||||
disable_games_tab: true,
|
||||
enable_tts_command: false,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
explicit_content_filter: 0,
|
||||
#[cfg(feature = "sqlx")]
|
||||
explicit_content_filter: 0.into(),
|
||||
friend_source_flags: Default::default(),
|
||||
gateway_connected: Some(false),
|
||||
gif_auto_play: false,
|
||||
|
@ -140,7 +125,6 @@ pub struct CustomStatus {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Copy, PartialOrd, Ord, Hash)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
pub struct FriendSourceFlags {
|
||||
pub all: bool,
|
||||
}
|
||||
|
@ -152,12 +136,8 @@ impl Default for FriendSourceFlags {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
pub struct GuildFolder {
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub color: Option<u32>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub color: Option<sqlx_pg_uint::PgU32>,
|
||||
pub guild_ids: Vec<String>,
|
||||
// FIXME: What is this thing?
|
||||
// It's not a snowflake, and it's sometimes a string and sometimes an integer.
|
||||
|
|
|
@ -71,8 +71,7 @@ impl PartialEq for Webhook {
|
|||
#[derive(
|
||||
Serialize, Deserialize, Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash,
|
||||
)]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
pub enum WebhookType {
|
||||
#[default]
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use bitflags::bitflags;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::{entities::PermissionOverwrite, ChannelType, DefaultReaction, Snowflake};
|
||||
use crate::types::{ChannelType, DefaultReaction, entities::PermissionOverwrite, Snowflake};
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Default, PartialEq, PartialOrd)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
|
@ -141,8 +141,7 @@ bitflags! {
|
|||
#[derive(Debug, Deserialize, Serialize, Clone, Copy, Default, PartialOrd, Ord, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
pub enum InviteType {
|
||||
#[default]
|
||||
Guild = 0,
|
||||
|
@ -153,8 +152,7 @@ pub enum InviteType {
|
|||
#[derive(Debug, Deserialize, Serialize, Clone, Copy, Default, PartialOrd, Ord, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||
#[repr(u8)]
|
||||
pub enum InviteTargetType {
|
||||
#[default]
|
||||
Stream = 1,
|
||||
|
@ -171,9 +169,7 @@ pub struct AddChannelRecipientSchema {
|
|||
}
|
||||
|
||||
/// See <https://discord-userdoccers.vercel.app/resources/channel#add-channel-recipient>
|
||||
#[derive(
|
||||
Debug, Deserialize, Serialize, Clone, Default, PartialOrd, Ord, PartialEq, Eq, Copy, Hash,
|
||||
)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone, Default, PartialOrd, Ord, PartialEq, Eq, Copy, Hash)]
|
||||
pub struct ModifyChannelPositionsSchema {
|
||||
pub id: Snowflake,
|
||||
pub position: Option<u32>,
|
||||
|
@ -182,9 +178,7 @@ pub struct ModifyChannelPositionsSchema {
|
|||
}
|
||||
|
||||
/// See <https://docs.discord.sex/resources/channel#follow-channel>
|
||||
#[derive(
|
||||
Debug, Deserialize, Serialize, Clone, Default, PartialOrd, Ord, PartialEq, Eq, Copy, Hash,
|
||||
)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone, Default, PartialOrd, Ord, PartialEq, Eq, Copy, Hash)]
|
||||
pub struct AddFollowingChannelSchema {
|
||||
pub webhook_channel_id: Snowflake,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue