Commit Graph

1507 Commits

Author SHA1 Message Date
kozabrada123 6718821c4c fix: use different chrono function due to deprecation 2024-08-28 19:32:23 +02:00
kozabrada123 b5008664c9 chore: fix doc lints 2024-08-28 19:28:08 +02:00
bitfl0wer 411db01786
Revert d846ce9948 2024-08-26 20:05:00 +02:00
Flori 76186a08f0
Make instance GatewayOptions configurable for library consumers (#555)
* Make instance GatewayOptions configurable for library consumers

* Update example in README
2024-08-26 19:36:42 +02:00
bitfl0wer d846ce9948
move up sending identify 2024-08-26 18:19:02 +02:00
bitfl0wer e316372631
Bump package versions 2024-08-26 13:56:28 +02:00
bitfl0wer 72c5d13eaf
Update README.md 2024-08-26 13:56:11 +02:00
bitfl0wer 05b9f1c801
Add missing `impl From<Snowflake> for u64`, closes `From<Snowflake> for u64` missing #550 2024-08-26 13:38:33 +02:00
Flori 9926f8ab94
Tungstenite: Match scheme for "ws" or "wss" (#554)
Match scheme for "ws" or "wss" and choose whether to connect with TLS connector for tungstenite
2024-08-26 13:32:37 +02:00
Flori 5bee907733
Prefer `&str` over `String` when possible (#553)
Prefer &str over String where possible.
2024-08-26 12:44:58 +02:00
Flori f0dbd3410f
sqlx_bitflag_derive: Use PgU64 as translation base (#552)
* sqlx_bitflag_derive: Use PgU64 as translation base

* Bump version of chorus-macros
2024-08-25 21:51:12 +02:00
Flori ebea18c991
Snowflake: PgU64 as base for sqlx (#551)
* Bump sqlx-pg-uint, sqlx

* Use PgU64 as base for implementations of sqlx traits for Snowflake
2024-08-25 21:27:33 +02:00
bitfl0wer e9b3de2342
Uncomment and update decode_token() 2024-08-22 21:52:29 +02:00
bitfl0wer cfccae8060
Bump sqlx-pg-uint 2024-08-22 00:31:53 +02:00
Flori 86b022912f
Initial support for PostgreSQL (#548)
* Change sqlx::Any to sqlx::Postgres

* Change sqlx::Any to sqlx::Postgres

* Remove JSONified overrides when sqlx feature is enabled, where it makes sense

* Add num-bigint dep

* Remove generic impl for From<T> for Snowflake
For some reason, this trait bound conflicts with another trait bound from the sqlx-pg-uint crate, even though I personally don't get why.

* Remove num_bigint, adsd sqlx-pg-uint

* swap u64 for PgU64 in some files

* use v0.3.0 of sqlx-pg-uint

* Lots of sqlx-postgres type changes

* Lots of sqlx-postgres type changes

* gwah

* Change repr(i8) to repr(i16) in enums when sqlx feature is enabled, fix sqlx incompatibilities

* impl sqlx::postgres::PgHasArrayType for Snowflake

* Try: derive Type for FriendSourceFlags, GuildFolder

* Try: Derive FromRow, Type for DefaultReaction

* Try: Derive Type for CustomStatus

* Try: Derive Type, FromRow for Tag

* Replace conditional compiling of uNN/PgUNN with conditional compiled type alias

* Fix: Conditional compiling errors and warnings

* Bump: wasm-bindgen* crate versions
2024-08-21 23:43:42 +02:00
kozabrada123 ec9541f38e
CI/CD: add cargo-doc job (#544)
* CI/CD: add cargo-doc job

* fix: make it rustdoc, totally not clippy
2024-08-09 08:53:43 +02:00
Flori e4dd31ef78
sqlx related improvements (#542)
* Bump sqlx to 0.8.0

* Update sqlx syntax to 0.8.0, change MySql for sqlx:: Any

* Update sqlx syntax to 0.8.0, change MySql for sqlx:: Any

* Modify chorus_macros::SqlxBitflagDerive to use sqlx::Any over sqlx::MySql (broken!)

* Fix: `cannot infer type for type parameter `DB` declared on the trait...`

* Change remaining impls of sqlx traits for MySql to sqlx::Any

* Alter chorus_macros to correctly derive SqlxBitFlag for sqlx::Any

* rustc/clippy>=v1.80.0: Do not warn when encountering cfg(tarpaulin_include)

* Port compare_* methods to sqlx v0.8.0
2024-08-04 13:08:56 +02:00
Flori ab82a5d49a
Update MSRV (#540)
* Update msrv
2024-08-02 21:12:38 +02:00
Flori 2bd9fbaa9c
bump versions of packages to latest compatible versions (#536) 2024-07-28 12:35:26 +02:00
bitfl0wer f2f45b4b86
bump versions of packages to latest compatible versions 2024-07-28 12:28:56 +02:00
Flori 582173234f
Manually implement std::default::Default for GatewayHeartbeat and Gat… (#535)
Manually implement std::default::Default for GatewayHeartbeat and
GatewayHeartbeatAck with the correct opcodes.
2024-07-28 11:49:49 +02:00
bitfl0wer 7bba7c6fcb
Manually implement std::default::Default for GatewayHeartbeat and GatewayHeartbeatAck 2024-07-27 15:31:47 +02:00
Flori 274b9ab0ca
More accurate "GatewayHello::default()" (#534)
Replaces the derived `std::default::Default` with

```rs
impl std::default::Default for GatewayHello {
    fn default() -> Self {
        Self {
            // "HELLO" opcode is 10
            op: 10,
            d: Default::default(),
        }
    }
}

impl std::default::Default for HelloData {
    fn default() -> Self {
        Self {
            // Discord docs mention 45000 seconds - discord.sex mentions 41250. Defaulting to 45s
            heartbeat_interval: 45000,
        }
    }
}
```
2024-07-26 23:37:28 +02:00
bitfl0wer d4f6a7e98a
More accurate "GatewayHello::default()" 2024-07-26 23:28:23 +02:00
Flori 537b0253bb
Theme colors patch (#533)
Related to #523, changes `theme_colors` property on `User` and
`PublicUser` to be of type `(u32, u32)`
2024-07-26 17:48:40 +02:00
bitfl0wer 9dbb5ea77b
impl sqlx::Type for ThemeColors 2024-07-26 17:40:42 +02:00
bitfl0wer ffcf15d058
Custom ThemeColors type with sqlx::Encode and sqlx::Decode impls 2024-07-26 17:30:43 +02:00
bitfl0wer 111a8c42f5
change theme_colors from Vec<u32> to (u32, u32) 2024-07-26 14:54:55 +02:00
kozabrada123 4292ab88e9
Fix #525 (pr #532) 2024-07-26 10:02:11 +02:00
kozabrada123 a27b488f61
Publically reexport Subscriber as Observer (#530)
Fixes the compile errors in the `voice_simple` example, updates the docs
in the `gateway_observers` example and adds a public reexport of
`Subscriber` as `Observer`, to make development easier and introduce
less breaking changes to our public api

to reduce the external dependencies needed for development with
`chorus`, we could also add some other reexports, potentially
`async_trait::async_trait`
2024-07-25 11:49:44 +02:00
kozabrada123 d829537713 remove cargo lock from example 2024-07-25 11:31:16 +02:00
kozabrada123 b9bc37fcd4 Readd Observer trait as reexport 2024-07-25 11:29:35 +02:00
kozabrada123 832576dbf4 Update documentation in gateway_observers example 2024-07-25 11:28:22 +02:00
kozabrada123 539460a552 Fix voice_simple example 2024-07-25 11:27:30 +02:00
bitfl0wer feb2b1b64c
Bump browser_version according to https://www.useragents.me/#most-common-desktop-useragents 2024-07-24 21:55:10 +02:00
Flori e8469c8e4f
Use cargo nextest (#529)
This PR switches the `linux` job from `cargo test` to `cargo nextest
run` for > 50% time reduction in the test execution step of the CI
pipeline. Also, the "check common non default feature configurations"
step has been moved from the `linux` job to it's own job, to parallelize
the CI pipeline further and reduce the time that CI needs to run to
completion.
2024-07-24 16:24:26 +02:00
bitfl0wer d15dfc302d
Revert: nextest on wasm 2024-07-24 16:17:00 +02:00
bitfl0wer 31509b9945
forgor installing nextest 2024-07-24 16:12:06 +02:00
bitfl0wer f32b3060cf
Cargo nextest on wasm, Parallelize "Check common non-default feat. cfg." 2024-07-24 16:09:33 +02:00
bitfl0wer cc7ed62cf2
Merge branch 'dev' into nextest 2024-07-24 15:59:21 +02:00
bitfl0wer 7bb35e5ed8
Increase limit integer size to match spacebars' possibilities 2024-07-24 15:57:12 +02:00
bitfl0wer f0fc6eab4d
Fix testcase that relied on false behavior implemented by older spacebar servers 2024-07-24 15:55:49 +02:00
bitfl0wer dd85a7de17
Fix/Correct UnavailableGuild object 2024-07-24 15:55:29 +02:00
bitfl0wer 6bc6651e80
Remove redundant "build" step
I mean the bloody thing already gets built with "cargo test", so...
2024-07-24 14:06:10 +02:00
bitfl0wer 0bfab58f2f
Use cargo nextest 2024-07-24 14:00:40 +02:00
bitfl0wer 6cd3c1081b
Use cargo nextest 2024-07-24 13:58:19 +02:00
bitfl0wer 7a2666bde2
Update CONTRIBUTING.md 2024-07-24 13:37:07 +02:00
Flori 1285d702d7
Derives (#526)
Adds about one billion (+- a few hundred million) missing derives for
all sorts of types.

The biggest change in this PR is, how structs holding a property
`Shared<T>` types implement `PartialEq`. In previous versions of this
crate, if a `Shared<T>` was part of a struct, this or these properties
would be ignored in == comparisons. This is because `Shared<T>` is
defined as `Arc<RwLock<T>>` - meaning you'd have to lock the `RwLock` to
make a comparison. From now on, instead of ignoring these properties or
locking the inner `RwLock`, the pointer values of the `Arc<T>`'s get
compared. This is a cheap and exact way of ensuring `Eq` for types,
which have an inner `Shared<T>`.
2024-07-20 18:07:20 +02:00
bitfl0wer 76146b0e8c
Fix: Compile error with no default features 2024-07-20 17:54:49 +02:00
bitfl0wer 88efef6015
Fix: Turn unconditional import of sqlx::types::Json into conditional one 2024-07-20 17:30:21 +02:00