Compare commits
3 Commits
bf94b9c04c
...
6916984225
Author | SHA1 | Date |
---|---|---|
bitfl0wer | 6916984225 | |
bitfl0wer | 859f3be213 | |
bitfl0wer | 4921487b33 |
|
@ -101,7 +101,7 @@ jobs:
|
|||
run: |
|
||||
rustup target add wasm32-unknown-unknown
|
||||
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
||||
cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.92" --force
|
||||
cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.93" --force
|
||||
GECKODRIVER=$(which geckodriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt, voice_gateway"
|
||||
wasm-chrome:
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -130,5 +130,5 @@ jobs:
|
|||
run: |
|
||||
rustup target add wasm32-unknown-unknown
|
||||
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
||||
cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.92" --force
|
||||
cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.93" --force
|
||||
CHROMEDRIVER=$(which chromedriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt, voice_gateway"
|
||||
|
|
|
@ -17,6 +17,12 @@ version = "1.0.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "adler2"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
|
||||
|
||||
[[package]]
|
||||
name = "aead"
|
||||
version = "0.5.2"
|
||||
|
@ -122,7 +128,7 @@ dependencies = [
|
|||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"miniz_oxide 0.7.4",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
]
|
||||
|
@ -584,12 +590,12 @@ checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
|
|||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.31"
|
||||
version = "1.0.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920"
|
||||
checksum = "9c0596c1eac1f9e04ed902702e9878208b336edc9d6fddc8a48387349bab3666"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
"miniz_oxide 0.8.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -769,9 +775,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.4.5"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab"
|
||||
checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205"
|
||||
dependencies = [
|
||||
"atomic-waker",
|
||||
"bytes",
|
||||
|
@ -992,7 +998,7 @@ dependencies = [
|
|||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"h2 0.4.5",
|
||||
"h2 0.4.6",
|
||||
"http 1.1.0",
|
||||
"http-body 1.0.1",
|
||||
"httparse",
|
||||
|
@ -1157,9 +1163,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.157"
|
||||
version = "0.2.158"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "374af5f94e54fa97cf75e945cce8a6b201e88a1a07e688b47dfd2a59c66dbd86"
|
||||
checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
|
@ -1263,6 +1269,15 @@ dependencies = [
|
|||
"adler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1"
|
||||
dependencies = [
|
||||
"adler2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.0.2"
|
||||
|
@ -2763,9 +2778,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "unicode-properties"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4259d9d4425d9f0661581b804cb85fe66a4c631cadd8f490d1c13a35d5d9291"
|
||||
checksum = "52ea75f83c0137a9b98608359a5f1af8144876eb67bcb1ce837368e906a9f524"
|
||||
|
||||
[[package]]
|
||||
name = "unicode_categories"
|
||||
|
|
|
@ -82,13 +82,13 @@ getrandom = { version = "0.2.15" }
|
|||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
getrandom = { version = "0.2.15", features = ["js"] }
|
||||
ws_stream_wasm = "0.7.4"
|
||||
wasm-bindgen-futures = "0.4.42"
|
||||
wasm-bindgen-futures = "0.4.43"
|
||||
wasmtimer = "0.2.0"
|
||||
|
||||
[dev-dependencies]
|
||||
lazy_static = "1.5.0"
|
||||
wasm-bindgen-test = "0.3.42"
|
||||
wasm-bindgen = "0.2.92"
|
||||
wasm-bindgen-test = "0.3.43"
|
||||
wasm-bindgen = "0.2.93"
|
||||
simple_logger = { version = "5.0.0", default-features = false }
|
||||
|
||||
[lints.rust]
|
||||
|
|
|
@ -16,6 +16,7 @@ use crate::types::{
|
|||
};
|
||||
|
||||
impl Message {
|
||||
#[allow(clippy::useless_conversion)]
|
||||
/// Sends a message in the channel with the provided channel_id.
|
||||
/// Returns the sent message.
|
||||
///
|
||||
|
|
27
src/lib.rs
27
src/lib.rs
|
@ -101,8 +101,7 @@ This crate uses Semantic Versioning 2.0.0 as its versioning scheme. You can read
|
|||
clippy::extra_unused_lifetimes,
|
||||
clippy::from_over_into,
|
||||
clippy::needless_borrow,
|
||||
clippy::new_without_default,
|
||||
clippy::useless_conversion
|
||||
clippy::new_without_default
|
||||
)]
|
||||
#![warn(
|
||||
clippy::todo,
|
||||
|
@ -111,7 +110,8 @@ This crate uses Semantic Versioning 2.0.0 as its versioning scheme. You can read
|
|||
clippy::print_stdout,
|
||||
clippy::print_stderr,
|
||||
missing_debug_implementations,
|
||||
missing_copy_implementations
|
||||
missing_copy_implementations,
|
||||
clippy::useless_conversion
|
||||
)]
|
||||
#[cfg(all(feature = "rt", feature = "rt_multi_thread"))]
|
||||
compile_error!("feature \"rt\" and feature \"rt_multi_thread\" cannot be enabled at the same time");
|
||||
|
@ -139,6 +139,27 @@ pub mod types;
|
|||
))]
|
||||
pub mod voice;
|
||||
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub type UInt128 = u128;
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub type UInt128 = sqlx_pg_uint::PgU128;
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub type UInt64 = u64;
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub type UInt64 = sqlx_pg_uint::PgU64;
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub type UInt32 = u32;
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub type UInt32 = sqlx_pg_uint::PgU32;
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub type UInt16 = u16;
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub type UInt16 = sqlx_pg_uint::PgU16;
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub type UInt8 = u8;
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub type UInt8 = sqlx_pg_uint::PgU8;
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
/// A URLBundle bundles together the API-, Gateway- and CDN-URLs of a Spacebar instance.
|
||||
///
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "sqlx")]
|
||||
use sqlx_pg_uint::PgU64;
|
||||
|
||||
use crate::types::utils::Snowflake;
|
||||
use crate::UInt64;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, PartialOrd)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
|
@ -18,20 +17,11 @@ pub struct Attachment {
|
|||
/// Max 1024 characters
|
||||
pub description: Option<String>,
|
||||
pub content_type: Option<String>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub size: u64,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub size: PgU64,
|
||||
pub size: UInt64,
|
||||
pub url: String,
|
||||
pub proxy_url: String,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub height: Option<u64>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub height: Option<PgU64>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub width: Option<u64>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub width: Option<PgU64>,
|
||||
pub height: Option<UInt64>,
|
||||
pub width: Option<UInt64>,
|
||||
pub ephemeral: Option<bool>,
|
||||
/// The duration of the audio file (only for voice messages)
|
||||
pub duration_secs: Option<f32>,
|
||||
|
@ -48,18 +38,12 @@ 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<UInt64>,
|
||||
pub filename: String,
|
||||
/// Max 1024 characters
|
||||
pub description: Option<String>,
|
||||
pub content_type: Option<String>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub size: Option<u64>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub size: Option<PgU64>,
|
||||
pub size: Option<UInt64>,
|
||||
pub url: Option<String>,
|
||||
pub proxy_url: Option<String>,
|
||||
pub height: Option<i32>,
|
||||
|
|
|
@ -7,13 +7,12 @@ use super::option_vec_arc_rwlock_ptr_eq;
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||
#[cfg(feature = "sqlx")]
|
||||
use sqlx_pg_uint::PgU64;
|
||||
|
||||
use crate::types::utils::Snowflake;
|
||||
use crate::types::{
|
||||
AutoModerationRuleTriggerType, IntegrationType, PermissionOverwriteType, Shared,
|
||||
};
|
||||
use crate::UInt64;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
|
@ -254,28 +253,16 @@ pub struct AuditEntryInfo {
|
|||
pub auto_moderation_rule_trigger_type: Option<AutoModerationRuleTriggerType>,
|
||||
pub channel_id: Option<Snowflake>,
|
||||
// #[serde(option_string)]
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub count: Option<u64>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub count: Option<PgU64>,
|
||||
pub count: Option<UInt64>,
|
||||
// #[serde(option_string)]
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub delete_member_days: Option<u64>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub delete_member_days: Option<PgU64>,
|
||||
pub delete_member_days: Option<UInt64>,
|
||||
/// The ID of the overwritten entity
|
||||
pub id: Option<Snowflake>,
|
||||
pub integration_type: Option<IntegrationType>,
|
||||
// #[serde(option_string)]
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub members_removed: Option<u64>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub members_removed: Option<PgU64>,
|
||||
pub members_removed: Option<UInt64>,
|
||||
// #[serde(option_string)]
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub message_id: Option<u64>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub message_id: Option<PgU64>,
|
||||
pub message_id: Option<UInt64>,
|
||||
pub role_name: Option<String>,
|
||||
#[serde(rename = "type")]
|
||||
pub overwrite_type: Option<PermissionOverwriteType>,
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#[cfg(feature = "client")]
|
||||
use crate::gateway::Updateable;
|
||||
use crate::types::Shared;
|
||||
use crate::UInt8;
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
use chorus_macros::Updateable;
|
||||
|
@ -82,14 +83,12 @@ pub struct AutoModerationRuleTriggerMetadataForKeywordPreset {
|
|||
pub allow_list: Vec<String>,
|
||||
}
|
||||
|
||||
#[allow(missing_copy_implementations)]
|
||||
#[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>
|
||||
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_total_limit: UInt8,
|
||||
pub mention_raid_protection_enabled: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ use crate::gateway::GatewayHandle;
|
|||
|
||||
#[cfg(feature = "client")]
|
||||
use crate::gateway::Updateable;
|
||||
use crate::UInt64;
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
use chorus_macros::{observe_option_vec, Composite, Updateable};
|
||||
|
@ -296,10 +297,7 @@ pub struct ThreadMember {
|
|||
pub id: Option<Snowflake>,
|
||||
pub user_id: Option<Snowflake>,
|
||||
pub join_timestamp: Option<DateTime<Utc>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub flags: Option<u64>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub flags: Option<sqlx_pg_uint::PgU64>,
|
||||
pub flags: Option<UInt64>,
|
||||
pub member: Option<Shared<GuildMember>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ use crate::types::{
|
|||
interfaces::WelcomeScreenObject,
|
||||
utils::Snowflake,
|
||||
};
|
||||
use crate::UInt64;
|
||||
|
||||
use super::{option_arc_rwlock_ptr_eq, vec_arc_rwlock_ptr_eq, PublicUser};
|
||||
|
||||
|
@ -273,10 +274,7 @@ pub struct GuildScheduledEvent {
|
|||
pub entity_id: Option<Snowflake>,
|
||||
pub entity_metadata: Option<GuildScheduledEventEntityMetadata>,
|
||||
pub creator: Option<Shared<User>>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub user_count: Option<u64>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub user_count: Option<sqlx_pg_uint::PgU64>,
|
||||
pub user_count: Option<UInt64>,
|
||||
pub image: Option<String>,
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ use crate::types::{
|
|||
utils::Snowflake,
|
||||
Shared,
|
||||
};
|
||||
use crate::{UInt16, UInt8};
|
||||
|
||||
#[derive(Default, Debug, Deserialize, Serialize, Clone)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
|
@ -23,14 +24,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>,
|
||||
pub expire_behaviour: Option<UInt8>,
|
||||
pub expire_grace_period: Option<UInt16>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub user: Option<Shared<User>>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
|
|
|
@ -10,6 +10,7 @@ use crate::types::{
|
|||
Guild, InviteFlags, InviteTargetType, InviteType, Shared, Snowflake, VerificationLevel,
|
||||
WelcomeScreenObject,
|
||||
};
|
||||
use crate::{UInt32, UInt8};
|
||||
|
||||
use super::guild::GuildScheduledEvent;
|
||||
use super::{Application, Channel, GuildMember, NSFWLevel, User};
|
||||
|
@ -39,14 +40,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>,
|
||||
pub max_age: Option<UInt32>,
|
||||
pub max_uses: Option<UInt8>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub stage_instance: Option<InviteStageInstance>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
|
@ -56,10 +51,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>,
|
||||
pub uses: Option<UInt32>,
|
||||
}
|
||||
|
||||
/// The guild an invite is for.
|
||||
|
|
|
@ -15,6 +15,7 @@ use crate::types::{
|
|||
utils::Snowflake,
|
||||
Shared,
|
||||
};
|
||||
use crate::{UInt32, UInt8};
|
||||
|
||||
use super::option_arc_rwlock_ptr_eq;
|
||||
|
||||
|
@ -150,10 +151,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 interaction_type: UInt8,
|
||||
pub name: String,
|
||||
pub user: User,
|
||||
pub member: Option<Shared<GuildMember>>,
|
||||
|
@ -285,14 +283,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,
|
||||
pub count: UInt32,
|
||||
pub burst_count: UInt32,
|
||||
#[serde(default)]
|
||||
pub me: bool,
|
||||
#[serde(default)]
|
||||
|
|
|
@ -8,6 +8,7 @@ use serde_aux::prelude::deserialize_option_number_from_string;
|
|||
use std::fmt::Debug;
|
||||
|
||||
use crate::types::utils::Snowflake;
|
||||
use crate::{UInt16, UInt32};
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
use chorus_macros::{Composite, Updateable};
|
||||
|
@ -32,10 +33,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,
|
||||
pub position: UInt16,
|
||||
#[serde(default)]
|
||||
pub permissions: PermissionFlags,
|
||||
pub managed: bool,
|
||||
|
@ -50,10 +48,7 @@ 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 total_months_subscribed: UInt32,
|
||||
pub is_renewal: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::utils::Snowflake;
|
||||
use crate::UInt64;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
|
||||
|
@ -13,10 +14,7 @@ pub struct SecurityKey {
|
|||
pub user_id: String,
|
||||
pub key_id: String,
|
||||
pub public_key: String,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub counter: u64,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub counter: sqlx_pg_uint::PgU64,
|
||||
pub counter: UInt64,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
|
@ -27,10 +25,8 @@ impl Default for SecurityKey {
|
|||
user_id: String::new(),
|
||||
key_id: String::new(),
|
||||
public_key: String::new(),
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
counter: 0,
|
||||
#[cfg(feature = "sqlx")]
|
||||
counter: sqlx_pg_uint::PgU64::from(0),
|
||||
#[allow(clippy::useless_conversion)]
|
||||
counter: 0u64.into(),
|
||||
name: String::new(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ use serde::{Deserialize, Serialize};
|
|||
use crate::types::entities::User;
|
||||
use crate::types::Shared;
|
||||
use crate::types::Snowflake;
|
||||
use crate::UInt8;
|
||||
|
||||
use super::arc_rwlock_ptr_eq;
|
||||
|
||||
|
@ -34,10 +35,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 membership_state: UInt8,
|
||||
pub permissions: Vec<String>,
|
||||
pub team_id: Snowflake,
|
||||
pub user: Shared<User>,
|
||||
|
|
|
@ -10,6 +10,7 @@ use crate::types::{
|
|||
utils::Snowflake,
|
||||
Shared,
|
||||
};
|
||||
use crate::UInt64;
|
||||
|
||||
/// See <https://docs.spacebar.chat/routes/#cmp--schemas-template>
|
||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||
|
@ -18,10 +19,7 @@ pub struct GuildTemplate {
|
|||
pub code: String,
|
||||
pub name: String,
|
||||
pub description: Option<String>,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub usage_count: Option<u64>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub usage_count: Option<sqlx_pg_uint::PgU64>,
|
||||
pub usage_count: Option<UInt64>,
|
||||
pub creator_id: Snowflake,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(skip))]
|
||||
pub creator: Shared<User>,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
use crate::errors::ChorusError;
|
||||
use crate::types::utils::Snowflake;
|
||||
use crate::{UInt32, UInt8};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_aux::prelude::deserialize_option_number_from_string;
|
||||
|
@ -47,10 +48,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>,
|
||||
pub accent_color: Option<UInt32>,
|
||||
#[cfg_attr(feature = "sqlx", sqlx(default))]
|
||||
pub locale: Option<String>,
|
||||
pub verified: Option<bool>,
|
||||
|
@ -61,10 +59,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 premium_type: Option<UInt8>,
|
||||
pub pronouns: Option<String>,
|
||||
pub public_flags: Option<UserFlags>,
|
||||
pub banner: Option<String>,
|
||||
|
@ -150,19 +145,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 accent_color: Option<UInt32>,
|
||||
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_type: Option<UInt8>,
|
||||
pub premium_since: Option<DateTime<Utc>>,
|
||||
pub public_flags: Option<UserFlags>,
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ use chrono::{serde::ts_milliseconds_option, Utc};
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::Shared;
|
||||
use crate::{UInt16, UInt32, UInt8};
|
||||
use serde_aux::field_attributes::deserialize_option_number_from_string;
|
||||
|
||||
#[derive(
|
||||
|
@ -42,16 +43,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 afk_timeout: Option<UInt16>,
|
||||
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 animate_stickers: UInt8,
|
||||
pub contact_sync_enabled: bool,
|
||||
pub convert_emoticons: bool,
|
||||
pub custom_status: Option<CustomStatus>,
|
||||
|
@ -60,10 +55,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 explicit_content_filter: UInt8,
|
||||
pub friend_source_flags: FriendSourceFlags,
|
||||
pub gateway_connected: Option<bool>,
|
||||
pub gif_auto_play: bool,
|
||||
|
@ -88,7 +80,8 @@ pub struct UserSettings {
|
|||
impl Default for UserSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
afk_timeout: Some(3600.into()),
|
||||
#[allow(clippy::useless_conversion)]
|
||||
afk_timeout: Some(3600u16.into()),
|
||||
allow_accessibility_detection: true,
|
||||
animate_emoji: true,
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
|
@ -156,10 +149,7 @@ impl Default for FriendSourceFlags {
|
|||
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow, sqlx::Type))]
|
||||
#[cfg_attr(feature = "sqlx", sqlx(type_name = "interface_type"))]
|
||||
pub struct GuildFolder {
|
||||
#[cfg(not(feature = "sqlx"))]
|
||||
pub color: Option<u32>,
|
||||
#[cfg(feature = "sqlx")]
|
||||
pub color: Option<sqlx_pg_uint::PgU32>,
|
||||
pub color: Option<UInt32>,
|
||||
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.
|
||||
|
|
Loading…
Reference in New Issue