Lots of sqlx-postgres type changes
This commit is contained in:
parent
aa706a2c4e
commit
e962ccd59c
|
@ -40,7 +40,7 @@ impl Message {
|
||||||
chorus_request.deserialize_response::<Message>(user).await
|
chorus_request.deserialize_response::<Message>(user).await
|
||||||
} else {
|
} else {
|
||||||
for (index, attachment) in message.attachments.iter_mut().enumerate() {
|
for (index, attachment) in message.attachments.iter_mut().enumerate() {
|
||||||
attachment.get_mut(index).unwrap().id = Some(index as i16);
|
attachment.get_mut(index).unwrap().id = Some((index as u64).into());
|
||||||
}
|
}
|
||||||
let mut form = reqwest::multipart::Form::new();
|
let mut form = reqwest::multipart::Form::new();
|
||||||
let payload_json = to_string(&message).unwrap();
|
let payload_json = to_string(&message).unwrap();
|
||||||
|
|
|
@ -224,7 +224,8 @@ pub struct ApplicationCommandOptionChoice {
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, Serialize_repr, Deserialize_repr, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, Serialize_repr, Deserialize_repr, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||||
#[repr(i32)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i8))]
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types>
|
/// See <https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types>
|
||||||
pub enum ApplicationCommandOptionType {
|
pub enum ApplicationCommandOptionType {
|
||||||
|
@ -294,7 +295,8 @@ pub struct ApplicationCommandPermission {
|
||||||
Ord,
|
Ord,
|
||||||
)]
|
)]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i8))]
|
||||||
/// See <https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type>
|
/// See <https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type>
|
||||||
pub enum ApplicationCommandPermissionType {
|
pub enum ApplicationCommandPermissionType {
|
||||||
#[default]
|
#[default]
|
||||||
|
|
|
@ -48,7 +48,10 @@ pub struct Attachment {
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||||
pub struct PartialDiscordFileAttachment {
|
pub struct PartialDiscordFileAttachment {
|
||||||
pub id: Option<i16>,
|
#[cfg(not(feature = "sqlx"))]
|
||||||
|
pub id: Option<u64>,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub id: Option<PgU64>,
|
||||||
pub filename: String,
|
pub filename: String,
|
||||||
/// Max 1024 characters
|
/// Max 1024 characters
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
|
|
|
@ -110,7 +110,8 @@ pub struct AuditLogChange {
|
||||||
PartialOrd,
|
PartialOrd,
|
||||||
Ord,
|
Ord,
|
||||||
)]
|
)]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||||
/// # Reference:
|
/// # Reference:
|
||||||
/// See <https://docs.discord.sex/resources/audit-log#audit-log-events>
|
/// See <https://docs.discord.sex/resources/audit-log#audit-log-events>
|
||||||
|
|
|
@ -32,7 +32,8 @@ pub struct AutoModerationRule {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default, Copy)]
|
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default, Copy)]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i8))]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
/// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types>
|
/// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types>
|
||||||
pub enum AutoModerationRuleEventType {
|
pub enum AutoModerationRuleEventType {
|
||||||
|
@ -43,7 +44,8 @@ pub enum AutoModerationRuleEventType {
|
||||||
#[derive(
|
#[derive(
|
||||||
Serialize_repr, Deserialize_repr, Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Copy,
|
Serialize_repr, Deserialize_repr, Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Copy,
|
||||||
)]
|
)]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i8))]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
/// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types>
|
/// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types>
|
||||||
pub enum AutoModerationRuleTriggerType {
|
pub enum AutoModerationRuleTriggerType {
|
||||||
|
@ -80,18 +82,22 @@ pub struct AutoModerationRuleTriggerMetadataForKeywordPreset {
|
||||||
pub allow_list: Vec<String>,
|
pub allow_list: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Copy)]
|
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
/// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata>
|
/// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-metadata>
|
||||||
pub struct AutoModerationRuleTriggerMetadataForMentionSpam {
|
pub struct AutoModerationRuleTriggerMetadataForMentionSpam {
|
||||||
/// Max 50
|
/// Max 50
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub mention_total_limit: u8,
|
pub mention_total_limit: u8,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub mention_total_limit: sqlx_pg_uint::PgU8,
|
||||||
pub mention_raid_protection_enabled: bool,
|
pub mention_raid_protection_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Serialize_repr, Deserialize_repr, Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Copy,
|
Serialize_repr, Deserialize_repr, Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Copy,
|
||||||
)]
|
)]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i8))]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
/// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types>
|
/// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-keyword-preset-types>
|
||||||
pub enum AutoModerationRuleKeywordPresetType {
|
pub enum AutoModerationRuleKeywordPresetType {
|
||||||
|
@ -110,9 +116,20 @@ pub struct AutoModerationAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[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,
|
||||||
)]
|
)]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i8))]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
/// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types>
|
/// See <https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types>
|
||||||
pub enum AutoModerationActionType {
|
pub enum AutoModerationActionType {
|
||||||
|
|
|
@ -194,7 +194,8 @@ pub struct PermissionOverwrite {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize_repr, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy)]
|
#[derive(Debug, Serialize_repr, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy)]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||||
/// # Reference
|
/// # Reference
|
||||||
///
|
///
|
||||||
/// See <https://docs.discord.sex/resources/channel#permission-overwrite-type>
|
/// See <https://docs.discord.sex/resources/channel#permission-overwrite-type>
|
||||||
|
|
|
@ -32,9 +32,6 @@ use super::option_arc_rwlock_ptr_eq;
|
||||||
pub struct Emoji {
|
pub struct Emoji {
|
||||||
pub id: Snowflake,
|
pub id: Snowflake,
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
#[cfg(feature = "sqlx")]
|
|
||||||
pub roles: Option<sqlx::types::Json<Vec<Snowflake>>>,
|
|
||||||
#[cfg(not(feature = "sqlx"))]
|
|
||||||
pub roles: Option<Vec<Snowflake>>,
|
pub roles: Option<Vec<Snowflake>>,
|
||||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||||
pub user: Option<Shared<User>>,
|
pub user: Option<Shared<User>>,
|
||||||
|
|
|
@ -303,7 +303,8 @@ impl PartialEq for GuildScheduledEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize_repr, Deserialize_repr, Debug, Default, Clone, PartialEq, Copy)]
|
#[derive(Serialize_repr, Deserialize_repr, Debug, Default, Clone, PartialEq, Copy)]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i8))]
|
||||||
/// See <https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level>
|
/// See <https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-privacy-level>
|
||||||
pub enum GuildScheduledEventPrivacyLevel {
|
pub enum GuildScheduledEventPrivacyLevel {
|
||||||
#[default]
|
#[default]
|
||||||
|
@ -311,7 +312,8 @@ pub enum GuildScheduledEventPrivacyLevel {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize_repr, Deserialize_repr, Debug, Default, Clone, PartialEq, Copy)]
|
#[derive(Serialize_repr, Deserialize_repr, Debug, Default, Clone, PartialEq, Copy)]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i8))]
|
||||||
/// See <https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status>
|
/// See <https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status>
|
||||||
pub enum GuildScheduledEventStatus {
|
pub enum GuildScheduledEventStatus {
|
||||||
#[default]
|
#[default]
|
||||||
|
@ -334,7 +336,8 @@ pub enum GuildScheduledEventStatus {
|
||||||
Copy,
|
Copy,
|
||||||
Hash,
|
Hash,
|
||||||
)]
|
)]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i8))]
|
||||||
/// See <https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types>
|
/// See <https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types>
|
||||||
pub enum GuildScheduledEventEntityType {
|
pub enum GuildScheduledEventEntityType {
|
||||||
#[default]
|
#[default]
|
||||||
|
@ -372,7 +375,8 @@ pub struct VoiceRegion {
|
||||||
Ord,
|
Ord,
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
/// See <https://discord-userdoccers.vercel.app/resources/guild#message-notification-level>
|
/// See <https://discord-userdoccers.vercel.app/resources/guild#message-notification-level>
|
||||||
pub enum MessageNotificationLevel {
|
pub enum MessageNotificationLevel {
|
||||||
|
@ -395,7 +399,8 @@ pub enum MessageNotificationLevel {
|
||||||
Ord,
|
Ord,
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i8))]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
/// See <https://discord-userdoccers.vercel.app/resources/guild#explicit-content-filter-level>
|
/// See <https://discord-userdoccers.vercel.app/resources/guild#explicit-content-filter-level>
|
||||||
pub enum ExplicitContentFilterLevel {
|
pub enum ExplicitContentFilterLevel {
|
||||||
|
@ -419,7 +424,8 @@ pub enum ExplicitContentFilterLevel {
|
||||||
Ord,
|
Ord,
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i8))]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
/// See <https://discord-userdoccers.vercel.app/resources/guild#verification-level>
|
/// See <https://discord-userdoccers.vercel.app/resources/guild#verification-level>
|
||||||
pub enum VerificationLevel {
|
pub enum VerificationLevel {
|
||||||
|
@ -445,7 +451,8 @@ pub enum VerificationLevel {
|
||||||
Ord,
|
Ord,
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i8))]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
/// See <https://discord-userdoccers.vercel.app/resources/guild#verification-level>
|
/// See <https://discord-userdoccers.vercel.app/resources/guild#verification-level>
|
||||||
pub enum MFALevel {
|
pub enum MFALevel {
|
||||||
|
@ -468,7 +475,8 @@ pub enum MFALevel {
|
||||||
Ord,
|
Ord,
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i8))]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
/// See <https://discord-userdoccers.vercel.app/resources/guild#verification-level>
|
/// See <https://discord-userdoccers.vercel.app/resources/guild#verification-level>
|
||||||
pub enum NSFWLevel {
|
pub enum NSFWLevel {
|
||||||
|
@ -493,7 +501,8 @@ pub enum NSFWLevel {
|
||||||
Ord,
|
Ord,
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i8))]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
/// See <https://discord-userdoccers.vercel.app/resources/guild#verification-level>
|
/// See <https://discord-userdoccers.vercel.app/resources/guild#verification-level>
|
||||||
pub enum PremiumTier {
|
pub enum PremiumTier {
|
||||||
|
|
|
@ -23,8 +23,14 @@ pub struct Integration {
|
||||||
pub syncing: Option<bool>,
|
pub syncing: Option<bool>,
|
||||||
pub role_id: Option<String>,
|
pub role_id: Option<String>,
|
||||||
pub enabled_emoticons: Option<bool>,
|
pub enabled_emoticons: Option<bool>,
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub expire_behaviour: Option<u8>,
|
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>,
|
pub expire_grace_period: Option<u16>,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub expire_grace_period: Option<sqlx_pg_uint::PgU16>,
|
||||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||||
pub user: Option<Shared<User>>,
|
pub user: Option<Shared<User>>,
|
||||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||||
|
|
|
@ -5,8 +5,11 @@
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use serde::{Deserialize, Serialize};
|
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::types::guild_configuration::GuildFeaturesList;
|
||||||
|
use crate::types::{
|
||||||
|
Guild, InviteFlags, InviteTargetType, InviteType, Shared, Snowflake, VerificationLevel,
|
||||||
|
WelcomeScreenObject,
|
||||||
|
};
|
||||||
|
|
||||||
use super::guild::GuildScheduledEvent;
|
use super::guild::GuildScheduledEvent;
|
||||||
use super::{Application, Channel, GuildMember, NSFWLevel, User};
|
use super::{Application, Channel, GuildMember, NSFWLevel, User};
|
||||||
|
@ -36,8 +39,14 @@ pub struct Invite {
|
||||||
pub invite_type: Option<InviteType>,
|
pub invite_type: Option<InviteType>,
|
||||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||||
pub inviter: Option<User>,
|
pub inviter: Option<User>,
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub max_age: Option<u32>,
|
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>,
|
pub max_uses: Option<u8>,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub max_uses: Option<sqlx_pg_uint::PgU8>,
|
||||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||||
pub stage_instance: Option<InviteStageInstance>,
|
pub stage_instance: Option<InviteStageInstance>,
|
||||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||||
|
@ -47,7 +56,10 @@ pub struct Invite {
|
||||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||||
pub target_user: Option<User>,
|
pub target_user: Option<User>,
|
||||||
pub temporary: Option<bool>,
|
pub temporary: Option<bool>,
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub uses: Option<u32>,
|
pub uses: Option<u32>,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub uses: Option<sqlx_pg_uint::PgU32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The guild an invite is for.
|
/// The guild an invite is for.
|
||||||
|
|
|
@ -150,7 +150,10 @@ pub enum MessageReferenceType {
|
||||||
pub struct MessageInteraction {
|
pub struct MessageInteraction {
|
||||||
pub id: Snowflake,
|
pub id: Snowflake,
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub interaction_type: u8,
|
pub interaction_type: u8,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub interaction_type: sqlx_pg_uint::PgU8,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub user: User,
|
pub user: User,
|
||||||
pub member: Option<Shared<GuildMember>>,
|
pub member: Option<Shared<GuildMember>>,
|
||||||
|
@ -282,8 +285,14 @@ pub struct EmbedField {
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||||
pub struct Reaction {
|
pub struct Reaction {
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub count: u32,
|
pub count: u32,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub count: sqlx_pg_uint::PgU32,
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub burst_count: u32,
|
pub burst_count: u32,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub burst_count: sqlx_pg_uint::PgU32,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub me: bool,
|
pub me: bool,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
@ -296,6 +305,8 @@ pub struct Reaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone, Copy, Serialize, Deserialize, Eq, PartialOrd, Ord)]
|
#[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 {
|
pub enum Component {
|
||||||
ActionRow = 1,
|
ActionRow = 1,
|
||||||
Button = 2,
|
Button = 2,
|
||||||
|
@ -320,7 +331,8 @@ pub struct MessageActivity {
|
||||||
Debug, Default, PartialEq, Clone, Copy, Serialize_repr, Deserialize_repr, Eq, PartialOrd, Ord,
|
Debug, Default, PartialEq, Clone, Copy, Serialize_repr, Deserialize_repr, Eq, PartialOrd, Ord,
|
||||||
)]
|
)]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://docs.discord.sex/resources/message#message-type>
|
/// See <https://docs.discord.sex/resources/message#message-type>
|
||||||
|
@ -464,7 +476,8 @@ pub struct PartialEmoji {
|
||||||
#[derive(Debug, PartialEq, Clone, Copy, Serialize, Deserialize, PartialOrd, Ord, Eq, Hash)]
|
#[derive(Debug, PartialEq, Clone, Copy, Serialize, Deserialize, PartialOrd, Ord, Eq, Hash)]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||||
pub enum ReactionType {
|
pub enum ReactionType {
|
||||||
Normal = 0,
|
Normal = 0,
|
||||||
Burst = 1, // The dreaded super reactions
|
Burst = 1, // The dreaded super reactions
|
||||||
|
|
|
@ -45,7 +45,8 @@ impl PartialEq for Relationship {
|
||||||
Copy,
|
Copy,
|
||||||
Hash,
|
Hash,
|
||||||
)]
|
)]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||||
/// See <https://discord-userdoccers.vercel.app/resources/user#relationship-type>
|
/// See <https://discord-userdoccers.vercel.app/resources/user#relationship-type>
|
||||||
pub enum RelationshipType {
|
pub enum RelationshipType {
|
||||||
Suggestion = 6,
|
Suggestion = 6,
|
||||||
|
|
|
@ -32,7 +32,10 @@ pub struct RoleObject {
|
||||||
pub hoist: bool,
|
pub hoist: bool,
|
||||||
pub icon: Option<String>,
|
pub icon: Option<String>,
|
||||||
pub unicode_emoji: Option<String>,
|
pub unicode_emoji: Option<String>,
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub position: u16,
|
pub position: u16,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub position: sqlx_pg_uint::PgU16,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub permissions: PermissionFlags,
|
pub permissions: PermissionFlags,
|
||||||
pub managed: bool,
|
pub managed: bool,
|
||||||
|
@ -47,11 +50,16 @@ pub struct RoleObject {
|
||||||
pub struct RoleSubscriptionData {
|
pub struct RoleSubscriptionData {
|
||||||
pub role_subscription_listing_id: Snowflake,
|
pub role_subscription_listing_id: Snowflake,
|
||||||
pub tier_name: String,
|
pub tier_name: String,
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub total_months_subscribed: u32,
|
pub total_months_subscribed: u32,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub total_months_subscribed: sqlx_pg_uint::PgU32,
|
||||||
pub is_renewal: bool,
|
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>
|
/// See <https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure>
|
||||||
pub struct RoleTags {
|
pub struct RoleTags {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
|
|
@ -21,8 +21,11 @@ pub struct StageInstance {
|
||||||
pub guild_scheduled_event_id: Option<Snowflake>,
|
pub guild_scheduled_event_id: Option<Snowflake>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Default, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(
|
||||||
#[repr(u8)]
|
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))]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
/// See <https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level>
|
/// See <https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level>
|
||||||
pub enum StageInstancePrivacyLevel {
|
pub enum StageInstancePrivacyLevel {
|
||||||
|
|
|
@ -77,7 +77,8 @@ pub struct StickerItem {
|
||||||
#[derive(
|
#[derive(
|
||||||
Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Hash, Serialize_repr, Deserialize_repr,
|
Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Hash, Serialize_repr, Deserialize_repr,
|
||||||
)]
|
)]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||||
#[serde(rename = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename = "SCREAMING_SNAKE_CASE")]
|
||||||
/// # Reference
|
/// # Reference
|
||||||
|
@ -93,7 +94,8 @@ pub enum StickerType {
|
||||||
#[derive(
|
#[derive(
|
||||||
Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Hash, Serialize_repr, Deserialize_repr,
|
Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Hash, Serialize_repr, Deserialize_repr,
|
||||||
)]
|
)]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://docs.discord.sex/resources/sticker#sticker-format-types>
|
/// See <https://docs.discord.sex/resources/sticker#sticker-format-types>
|
||||||
|
|
|
@ -34,7 +34,10 @@ impl PartialEq for Team {
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||||
pub struct TeamMember {
|
pub struct TeamMember {
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub membership_state: u8,
|
pub membership_state: u8,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub membership_state: sqlx_pg_uint::PgU8,
|
||||||
pub permissions: Vec<String>,
|
pub permissions: Vec<String>,
|
||||||
pub team_id: Snowflake,
|
pub team_id: Snowflake,
|
||||||
pub user: Shared<User>,
|
pub user: Shared<User>,
|
||||||
|
|
|
@ -47,7 +47,10 @@ pub struct User {
|
||||||
pub bot: Option<bool>,
|
pub bot: Option<bool>,
|
||||||
pub system: Option<bool>,
|
pub system: Option<bool>,
|
||||||
pub mfa_enabled: Option<bool>,
|
pub mfa_enabled: Option<bool>,
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub accent_color: Option<u32>,
|
pub accent_color: Option<u32>,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub accent_color: Option<sqlx_pg_uint::PgU32>,
|
||||||
#[cfg_attr(feature = "sqlx", sqlx(default))]
|
#[cfg_attr(feature = "sqlx", sqlx(default))]
|
||||||
pub locale: Option<String>,
|
pub locale: Option<String>,
|
||||||
pub verified: Option<bool>,
|
pub verified: Option<bool>,
|
||||||
|
@ -58,7 +61,10 @@ pub struct User {
|
||||||
#[serde(deserialize_with = "deserialize_option_number_from_string")]
|
#[serde(deserialize_with = "deserialize_option_number_from_string")]
|
||||||
pub flags: Option<UserFlags>,
|
pub flags: Option<UserFlags>,
|
||||||
pub premium_since: Option<DateTime<Utc>>,
|
pub premium_since: Option<DateTime<Utc>>,
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub premium_type: Option<u8>,
|
pub premium_type: Option<u8>,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub premium_type: Option<sqlx_pg_uint::PgU8>,
|
||||||
pub pronouns: Option<String>,
|
pub pronouns: Option<String>,
|
||||||
pub public_flags: Option<UserFlags>,
|
pub public_flags: Option<UserFlags>,
|
||||||
pub banner: Option<String>,
|
pub banner: Option<String>,
|
||||||
|
@ -144,13 +150,19 @@ pub struct PublicUser {
|
||||||
pub username: Option<String>,
|
pub username: Option<String>,
|
||||||
pub discriminator: Option<String>,
|
pub discriminator: Option<String>,
|
||||||
pub avatar: Option<String>,
|
pub avatar: Option<String>,
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub accent_color: Option<u32>,
|
pub accent_color: Option<u32>,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub accent_color: Option<sqlx_pg_uint::PgU32>,
|
||||||
pub banner: Option<String>,
|
pub banner: Option<String>,
|
||||||
pub theme_colors: Option<ThemeColors>,
|
pub theme_colors: Option<ThemeColors>,
|
||||||
pub pronouns: Option<String>,
|
pub pronouns: Option<String>,
|
||||||
pub bot: Option<bool>,
|
pub bot: Option<bool>,
|
||||||
pub bio: Option<String>,
|
pub bio: Option<String>,
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub premium_type: Option<u8>,
|
pub premium_type: Option<u8>,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub premium_type: Option<sqlx_pg_uint::PgU8>,
|
||||||
pub premium_since: Option<DateTime<Utc>>,
|
pub premium_since: Option<DateTime<Utc>>,
|
||||||
pub public_flags: Option<UserFlags>,
|
pub public_flags: Option<UserFlags>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,10 @@ pub struct UserSettings {
|
||||||
pub afk_timeout: Option<u16>,
|
pub afk_timeout: Option<u16>,
|
||||||
pub allow_accessibility_detection: bool,
|
pub allow_accessibility_detection: bool,
|
||||||
pub animate_emoji: bool,
|
pub animate_emoji: bool,
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub animate_stickers: u8,
|
pub animate_stickers: u8,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub animate_stickers: sqlx_pg_uint::PgU8,
|
||||||
pub contact_sync_enabled: bool,
|
pub contact_sync_enabled: bool,
|
||||||
pub convert_emoticons: bool,
|
pub convert_emoticons: bool,
|
||||||
pub custom_status: Option<CustomStatus>,
|
pub custom_status: Option<CustomStatus>,
|
||||||
|
@ -54,7 +57,10 @@ pub struct UserSettings {
|
||||||
pub developer_mode: bool,
|
pub developer_mode: bool,
|
||||||
pub disable_games_tab: bool,
|
pub disable_games_tab: bool,
|
||||||
pub enable_tts_command: bool,
|
pub enable_tts_command: bool,
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub explicit_content_filter: u8,
|
pub explicit_content_filter: u8,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub explicit_content_filter: sqlx_pg_uint::PgU8,
|
||||||
pub friend_source_flags: FriendSourceFlags,
|
pub friend_source_flags: FriendSourceFlags,
|
||||||
pub gateway_connected: Option<bool>,
|
pub gateway_connected: Option<bool>,
|
||||||
pub gif_auto_play: bool,
|
pub gif_auto_play: bool,
|
||||||
|
@ -82,7 +88,10 @@ impl Default for UserSettings {
|
||||||
afk_timeout: Some(3600),
|
afk_timeout: Some(3600),
|
||||||
allow_accessibility_detection: true,
|
allow_accessibility_detection: true,
|
||||||
animate_emoji: true,
|
animate_emoji: true,
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
animate_stickers: 0,
|
animate_stickers: 0,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
animate_stickers: 0.into(),
|
||||||
contact_sync_enabled: false,
|
contact_sync_enabled: false,
|
||||||
convert_emoticons: false,
|
convert_emoticons: false,
|
||||||
custom_status: None,
|
custom_status: None,
|
||||||
|
@ -91,7 +100,10 @@ impl Default for UserSettings {
|
||||||
developer_mode: true,
|
developer_mode: true,
|
||||||
disable_games_tab: true,
|
disable_games_tab: true,
|
||||||
enable_tts_command: false,
|
enable_tts_command: false,
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
explicit_content_filter: 0,
|
explicit_content_filter: 0,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
explicit_content_filter: 0.into(),
|
||||||
friend_source_flags: Default::default(),
|
friend_source_flags: Default::default(),
|
||||||
gateway_connected: Some(false),
|
gateway_connected: Some(false),
|
||||||
gif_auto_play: false,
|
gif_auto_play: false,
|
||||||
|
@ -137,7 +149,10 @@ impl Default for FriendSourceFlags {
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct GuildFolder {
|
pub struct GuildFolder {
|
||||||
|
#[cfg(not(feature = "sqlx"))]
|
||||||
pub color: Option<u32>,
|
pub color: Option<u32>,
|
||||||
|
#[cfg(feature = "sqlx")]
|
||||||
|
pub color: Option<sqlx_pg_uint::PgU32>,
|
||||||
pub guild_ids: Vec<String>,
|
pub guild_ids: Vec<String>,
|
||||||
// FIXME: What is this thing?
|
// FIXME: What is this thing?
|
||||||
// It's not a snowflake, and it's sometimes a string and sometimes an integer.
|
// It's not a snowflake, and it's sometimes a string and sometimes an integer.
|
||||||
|
|
|
@ -71,7 +71,8 @@ impl PartialEq for Webhook {
|
||||||
#[derive(
|
#[derive(
|
||||||
Serialize, Deserialize, Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash,
|
Serialize, Deserialize, Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash,
|
||||||
)]
|
)]
|
||||||
#[repr(u8)]
|
#[cfg_attr(not(feature = "sqlx"), repr(u8))]
|
||||||
|
#[cfg_attr(feature = "sqlx", repr(i16))]
|
||||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||||
pub enum WebhookType {
|
pub enum WebhookType {
|
||||||
#[default]
|
#[default]
|
||||||
|
|
Loading…
Reference in New Issue