Commit Graph

1030 Commits

Author SHA1 Message Date
Flori 19159b0196 Enhancement/updatemessage (#190)
Implements UpdateMessage for some more Gateway Events.
2023-08-20 16:10:28 +02:00
bitfl0wer 6cb28dda92 Start implementing some UpdateMessages 2023-08-19 01:13:07 +02:00
bitfl0wer 0b840372e2 Handle id().is_none() cases 2023-08-18 23:40:01 +02:00
bitfl0wer d64004b308 Make id(&self) return Option<Snowflake> 2023-08-18 23:34:00 +02:00
bitfl0wer 82d2151f1b Fix typo 2023-08-18 21:29:34 +02:00
bitfl0wer e1615a4cd3 Remove prints 2023-08-18 20:20:58 +02:00
bitfl0wer 5f0a04c345 Add Arc<RwLock<T>> 2023-08-18 20:20:53 +02:00
bitfl0wer cafa84d41e Add Todo to every event which needs UpdateMessage 2023-08-18 20:20:25 +02:00
kozabrada123 ad58b550fb Minor gateway updates (#188)
* Fix TYPING_START not existing

* Fix spacebar READY deserialization error
2023-08-18 14:27:39 +02:00
Flori a9bbd51c2d Add content type specification (#187)
This pr adds specifying the Content-Type header for requests with a body

Should be all requests but lmk if I missed any
2023-08-18 11:59:14 +02:00
kozabrada123 905b7af618 Add content type specification 2023-08-18 11:41:06 +02:00
Flori 38a7475938 Change type of Channel::last_pin_timestamp (#186)
Closes #160
2023-08-17 22:56:33 +02:00
bitfl0wer c2c1ad93b6 Change type of Channel::last_pin_timestamp 2023-08-17 22:45:42 +02:00
Flori d2ff34608d Change bearer_auth to header("Authorization" (#185)
Closes #181
2023-08-17 22:42:12 +02:00
bitfl0wer 0396e318d3 Change bearer_auth to header("Authorization" 2023-08-17 22:26:07 +02:00
Flori ecdab68677 Improved auto updating structs (#184)
This PR does the following things:
- Give `UserMeta` a `GatewayHandle`
- Change struct-fields which are supposed to be "shared" to
`Arc<RwLock<T>>`. "shared" struct-fields are things like a `Channel`
object, which may exist both on their own, and inside a `Guild`s struct
fields. Due to sharing this field, we only need to update a single
object to propagate the changes everywhere.
- Some light refactorings across the project. Example: change
`UserMeta::get()` to `UserMeta::get_user()`
- Add `Composite` trait and proc macro. `Composites` are `Updateable`
(uniquely identifiable) objects, which contain at least one other shared
(`Arc<RwLock<T>>`) field. This trait/macro provides functionality to not
only watch an object, but also all observable struct fields in that
object.
- Gets rid of tokio::channel in favor of Arc<RwLock<T>>

To-do before merging:

- [x] Properly test `Composite` functionality to ensure it works as
intended

I'd love a second pair of eyes over this, especially in case I forgot
something major ^^'
2023-08-17 19:40:47 +02:00
bitfl0wer 4424e3f07a Remove comment 2023-08-17 18:26:34 +02:00
bitfl0wer d69a459025 Remove prints 2023-08-17 18:26:14 +02:00
bitfl0wer 711580f270 Call watch_whole either way 2023-08-17 18:26:06 +02:00
bitfl0wer adf3d4ef31 Update test a little 2023-08-17 18:23:57 +02:00
bitfl0wer 4210bd6d73 Remove debug prints 2023-08-16 22:04:43 +02:00
bitfl0wer a1df997c9f I think i found out why shit no work 2023-08-16 22:04:36 +02:00
bitfl0wer 7c8ad3ffcf Rewrite recursive update test (still fails sob) 2023-08-16 22:04:24 +02:00
bitfl0wer 29b9050e6d Make store pub(crate), other adjustments 2023-08-16 22:04:07 +02:00
bitfl0wer 887ba4a1b1 Make trait Debug 2023-08-16 21:26:27 +02:00
bitfl0wer fbf72b74d0 Remove tokio watch channels 2023-08-16 21:26:19 +02:00
bitfl0wer e9f94267c6 Add recursive-updating-structs test 2023-08-16 14:06:04 +02:00
bitfl0wer 116c829f28 Rename update to modify 2023-08-16 14:05:51 +02:00
bitfl0wer 9ce75482d1 Make Role Clone 2023-08-16 14:05:44 +02:00
bitfl0wer 2af8388947 Add GuildRoleCreate and -Update 2023-08-16 14:05:37 +02:00
bitfl0wer e0340047fb Remove import 2023-08-16 01:11:48 +02:00
bitfl0wer e43fe061b3 Refactor test 2023-08-16 01:11:32 +02:00
bitfl0wer 5f0f19e8ce Rename functions, add observe_and_into_inner 2023-08-16 01:11:26 +02:00
bitfl0wer a9381fec1e Revert "Give `GatewayHandle` and `Gateway` common trait to call `watch_whole()` or observe() from a `Gateway`"
This reverts commit d36b1de170.
2023-08-16 00:21:18 +02:00
bitfl0wer 01193b7482 Merge branch 'enhancement/improved-auto-updating-structs' of https://github.com/polyphony-chat/chorus into enhancement/improved-auto-updating-structs 2023-08-16 00:18:36 +02:00
bitfl0wer d36b1de170 Give `GatewayHandle` and `Gateway` common trait to call `watch_whole()` or observe() from a `Gateway` 2023-08-16 00:18:32 +02:00
bitfl0wer 8087dd69c8 Give `GatewayHandle` and `Gateway` common trait to call `watch_whole()` or observe() from a `Gateway` 2023-08-15 23:41:42 +02:00
bitfl0wer 2b21933cb3 Add back set_json. No idea when it disappeared? 2023-08-15 22:19:47 +02:00
bitfl0wer b1594cf1e1 Merge branch 'feature/update-message-all-events' into enhancement/improved-auto-updating-structs 2023-08-15 20:53:56 +02:00
bitfl0wer 2fd1a7e7f4 Remove unused import 2023-08-15 20:30:30 +02:00
bitfl0wer c03b250248 Clean up test 2023-08-15 20:20:58 +02:00
bitfl0wer ff77e5a61d Add `Composite` derive to all entities which require it 2023-08-15 20:19:52 +02:00
bitfl0wer bdeaa476e2 Add `Composite<T>` bound to automatically call `watch_whole()` on caller object. 2023-08-15 20:19:16 +02:00
bitfl0wer 32fd918a43 Remove `Send` bound 2023-08-15 20:18:11 +02:00
bitfl0wer c3be91667b Try calling new method to see if it panics 2023-08-15 17:54:48 +02:00
bitfl0wer 7de3204f59 Make trait pub 2023-08-15 17:54:36 +02:00
bitfl0wer 20baada605 Add Composite to some types 2023-08-15 17:38:53 +02:00
bitfl0wer 5ac680b64d Remove superfluous nesting 2023-08-15 17:08:27 +02:00
bitfl0wer 509ab578d6 Implement trait methods 2023-08-15 16:58:20 +02:00
bitfl0wer 37d976cd0d Try out new macro 2023-08-15 16:58:06 +02:00