Commit Graph

891 Commits

Author SHA1 Message Date
bitfl0wer 68868e7d35
Remove stupid comment from me 2023-08-14 00:04:53 +02:00
bitfl0wer f0f47315a1
Rename get to get_user 2023-08-14 00:02:30 +02:00
bitfl0wer 888a86903b
Change UserMeta::get() to take self instead of Self 2023-08-14 00:02:03 +02:00
bitfl0wer 9ce575944c
Change UpdateMessage<T> to write into RwLock 2023-08-13 16:46:57 +02:00
bitfl0wer 8ca4ba6e50
Change observe() again, pass Arc<RwLock<T>> into message.update(), Add comment explaining closure 2023-08-13 16:46:21 +02:00
bitfl0wer f5d74c57a4
Remove channel_id argument from modify. WHY WAS IT THERE TO BEGIN WITH LOL 2023-08-13 15:54:25 +02:00
bitfl0wer 041ee223c3
Moddify observe to still store T internally 2023-08-13 15:52:16 +02:00
fowb bca1092dd0 Add fixme comment 2023-08-12 22:40:07 +02:00
fowb d28f19d8ca Change observe() to take Arc<RwLock<T>> 2023-08-12 19:47:11 +02:00
fowb b672dd221c Change Mutex<T> to RwLock<T> 2023-08-12 19:31:31 +02:00
kozabrada123 5faee2cbd1
Fix trailing /s (#180) 2023-08-12 16:48:33 +02:00
kozabrada123 855a4278df
Minor snowflake updates (#179)
* Make snowflake fully public

* Simple into for snowflake
2023-08-07 20:34:58 +02:00
bitfl0wer 207e67396a
Fix unwrap panic on trying to access rate limits 2023-08-07 14:56:10 +02:00
kozabrada123 6d5a1ad295
Minor improvements to message events (#177) 2023-08-07 14:15:23 +02:00
bitfl0wer b2a3294b5d
update mutex to rwlock 2023-08-04 20:08:49 +02:00
bitfl0wer 38a97fc37a
Change Arc<Mutex<T>> components to Arc<RwLock<T>> 2023-08-04 17:57:03 +02:00
bitfl0wer 1eb581c049
Add note about Gateway: store 2023-08-04 16:54:56 +02:00
bitfl0wer 9fe55559c7
Add note about GatewayHandle: `store` 2023-08-04 16:54:03 +02:00
bitfl0wer 1154cc98a1
Make message mut 2023-08-04 16:46:22 +02:00
bitfl0wer 043aaf5e59
Add clone bound to T 2023-08-04 16:46:15 +02:00
bitfl0wer adb5b47bbd
Fix channel.rs 2023-08-04 16:41:57 +02:00
bitfl0wer 9fec38142c
Add update_object 2023-08-04 16:41:51 +02:00
kozabrada123 4d0f27a668 Re-add derives to structs where possible 2023-08-04 15:33:46 +02:00
bitfl0wer 578b4c2fa9
Integrate component behaviour everywhere 2023-08-04 11:19:23 +02:00
bitfl0wer 96213aaf24
Make components be Arc<Mutex<T>> 2023-08-02 23:08:53 +02:00
bitfl0wer 2bfdf4e3e9
Add PartialEq, Eq, Hash to Enums 2023-08-02 20:23:50 +02:00
bitfl0wer 5d66ad83f2
Start component-izing entities, remove PartialEq wherever needed (because PartialEq isn't implemented for Mutex) 2023-08-02 20:18:16 +02:00
kozabrada123 6cbde1a04b Fix missing references to the best of my ability 2023-07-31 10:28:18 +02:00
kozabrada123 9f39943b15 Goof 2023-07-31 10:07:56 +02:00
kozabrada123 4e4e279333 Docs 2023-07-31 10:01:25 +02:00
kozabrada123 abb3c7e0e6 Merge branch 'main' into fix/doc-improvements 2023-07-31 09:13:33 +02:00
Flori 18faea5aad
Remove newline 2023-07-30 20:35:02 +02:00
Vivien 6ec26feffb update of reaction struct 2023-07-30 20:27:13 +02:00
Vivien 909f1c0285 change signed to unsigned integer 2023-07-30 20:23:12 +02:00
kozabrada123 b99bcef1f6 Guilds + Channels 2023-07-30 09:04:31 +02:00
kozabrada123 51679e773c Fix broken links 2023-07-30 08:31:12 +02:00
kozabrada123 499faefa51 Documemtaiom 2023-07-30 08:26:26 +02:00
kozabrada123 b897e44cca Document a small bit of attachment 2023-07-29 18:12:57 +02:00
kozabrada123 1893dfe0f9 Permissions with code blocks 2023-07-29 18:12:57 +02:00
kozabrada123 49801bef10
Update src/types/utils/rights.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:07:06 +00:00
kozabrada123 8954fd2ae5
Update src/types/utils/snowflake.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:06:49 +00:00
kozabrada123 5ed24eea62
Update src/types/utils/rights.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:06:35 +00:00
kozabrada123 d4048d8845
Update src/types/utils/rights.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:05:27 +00:00
kozabrada123 5d49e72461
Update src/types/utils/rights.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:04:49 +00:00
kozabrada123 b4b9f87520
Capitalise docs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-29 16:04:08 +00:00
kozabrada123 abcdd5e128 Forgot this since had the lint on my local copy 2023-07-29 11:45:25 +02:00
kozabrada123 9c4136644b Document some flags 2023-07-29 11:26:10 +02:00
kozabrada123 a4f59fcdf4 Minor doc changes 2023-07-29 11:26:00 +02:00
kozabrada123 3058025e9d Document rights 2023-07-29 11:00:28 +02:00
kozabrada123 787da3092c Moar docs 2023-07-29 10:23:04 +02:00
kozabrada123 a2ddafb6a1 Remove the todos from the last commit 2023-07-28 18:57:35 +02:00
kozabrada123 1f9efa98e3 Better docs 2023-07-28 18:45:40 +02:00
kozabrada123 577c8a2d71 Merge branch 'main' into fix/doc-improvements 2023-07-28 18:21:20 +02:00
Flori fa7dd4b92b
Improve auto updating structs usage (#168)
* Add `GatewayHandle` to `UserMeta`

* Make user::shell async due to gateway add
2023-07-24 19:13:53 +02:00
SpecificProtagonist 24450571de
derive Updateable (#167) 2023-07-22 11:20:31 +02:00
Flori 38f0659ec9
Auto updating structs (#163)
* Gateway fields don't need to be pub

* Add store to Gateway

* Add UpdateMessage trait

* Proof of concept: impl UpdateMessage for Channel

* Start working on auto updating structs

* Send entity updates over watch channel

* Add id to UpdateMessage

* Create trait Updateable

* Add documentation

* add gateway test

* Complete test

* Impl UpdateMessage::update() for ChannelUpdate

* Impl UpdateMessage::update() for ChannelUpdate
Co-authored by: SpecificProtagonist <specificprotagonist@posteo.org>

* make channel::modify no longer mutate Channel

* change modify call

* remove unused imports

* Allow dead code with TODO to remove it

* fix channel::modify test

* Update src/gateway.rs

Co-authored-by: SpecificProtagonist <vincentjunge@posteo.net>

---------

Co-authored-by: SpecificProtagonist <vincentjunge@posteo.net>
2023-07-21 15:35:31 +02:00
kozabrada123 260dd320a8 Merge stuff 2023-07-21 14:10:50 +02:00
SpecificProtagonist f97d26bc6c
Fix gateway heartbeat blocking (#162)
fix gateway heartbeat blocking
2023-07-21 13:59:40 +02:00
Flori b5a8562d89
Fix: message file attachment duplication (#159)
* make send() take ownership of MessageSendSchema

* Remove message file attachment duplication

* Remove superfluous docstrings
2023-07-17 23:26:25 +02:00
Flori 7df6cb183f
Join/Leave Guilds, (Group) DMs and minor improvements (#157)
## Summary:

**Added:**
- Schemas `PrivateChannelCreateSchema` `ChannelInviteCreateSchema`, `AddChannelRecipientSchema` recursively (including schemas which were needed to create these schemas)
- Methods `create_private_channel`, `leave_guild`, `accept_invite`, `create_user_invite`, `create_guild_invite`, `add_channel_recipient`, `remove_channel_recipient`
- Integration tests for the functionality covered by implementing #45
- Documentation in some places where I noticed it would be useful to have some
- `create_user` method in `/src/tests`: Cuts down on test boilerplate needed to create an addition test user

**Changed:**
- `.gitignore`
  - Added `.DS_store` files to gitignore (some weird macos files), removed Cargo.lock, as Cargo.lock should be included for libraries
- Added a lot of default trait derives like Clone, Copy, PartialEq, Eq, Ord, PartialOrd to structs and enums where I saw them missing
- Added missing `teardown()` calls to the integration tests
- Renamed integration test files in `/src/tests` dir to all be plural: `channel.rs` -> `channels.rs`
- Made more fields on `User` type `Option<>`
- All instances in `/src/tests` where a second test user was created using a RegistrationSchema and the register_user method were replaced with the new `create_user` method
- README.md: Marked roadmap fields covered by #45 as implemented
- Changed visibility of `/src/tests/common/mod.rs` methods from `pub` to `pub(crate)`. In hindsight, this was probably not required, haha

**Removed:**
- Unneeded import in`src/types/config/types/guild_configuration.rs`


## Commit log:

* Add .DS_store, remove Cargo.lock

* Create PrivateChannelCreateSchema

* pub use users

* add channels.rs

* create channels.rs

* Add Deserialize/Serialize derives

* Implement create_private_channel

* Add create_dm() test

* Make optional fields on `User` `Option<>`

* Check boxes for implemented features

* Create users/guilds.rs

* Remove unneeded import

* Add UserMeta::leave_guild()

* Create api/invites/mod.rs

* Add debug print to send_request

* Rename tests files

* Create invites.rs

* create invite.rs

* Add documentation

* Implement accept_invite

* Sort fields on Channel alphabetically

* Add invite mod

* Add forgotten teardown() at test end

* change visiblities, add create_user()

* Implement `create_user_invite()`

* start working on invite tests

* Add allow flags

* Fix bad url

* Create CreateChannelInviteSchema and friends

* remove non-implemented test code

* add body to requests

* Add Clone to UserMeta

* More comprehensive error message when running into a deserialization error

* Add arguments documentation to accept_invite

* Add Eq derive to GuildFeaturesList

* Add Eq derive to Emoji

* Add Eq derive to GuildBan

* Add create_accept_invite() test

* Add Default derive to ChannelCreateSchema

* Change create_guild_invite to return GuildInvite

* Dates as chrono::Date(Utc); sort alphabetically

* Add default derives wherever possible

* Implement add_- and remove_channel_recipient

* Create AddChannelRecipientSchema

* replace otheruser regs with bundle.creeate_user()

* Add (disabled) test remove_add_person_from_to_dm()
2023-07-17 19:36:28 +02:00
Flori bfdf21f57f
Enable saving and loading LimitsConfiguration (#152)
Impl Serialize, Deserialize for LimitsConfiguration and children
2023-07-14 17:38:54 +02:00
SpecificProtagonist 05d51bd0bc
Deduplicate gateway dispatch event handling (#148)
deduplicate gateway dispatch event handling
2023-07-11 20:11:13 +02:00
kozabrada123 d3613702bb Add some docs 2023-07-11 19:54:04 +02:00
kozabrada123 7cdaf35583 Merge branch 'main' into fix/doc-improvements 2023-07-11 19:24:37 +02:00
Zert3x d5979e0024
Async Observer Trait (#147) 2023-07-11 19:20:27 +02:00
kozabrada123 133021a805 Rustdoc warnings + misc changes 2023-07-10 18:06:45 +02:00
kozabrada123 832cb92abc UrlBundle slightly better docs 2023-07-10 17:22:31 +02:00
kozabrada123 282bc06cff /* -> /// 2023-07-10 16:59:00 +02:00
Flori 8c9ccdd997
Ratelimiter overhaul (#144)
* Rename limits and limit to have better names

* Remove empty lines

* Remove handle_request (moved to requestlimiter)

* Start working on new ratelimiter

* Make limits Option, add "limited?" to constructor

* Add missing logic to send_request

* Rename Limits

* Create Ratelimits and Limit Struct

* Define Limit

* Import Ratelimits

* Define get_rate_limits

* Remove unused import

* + check_rate_limits & limits_config_to_ratelimits

* Remove Absolute Limits
These limits are not meant to be tracked anyways.

* add ratelimits is_exhausted

* Add error handling and send request checking

* change limits to option ratelimits

* Add strum

* Change Ratelimits to Hashmap

* Remove ratelimits in favor of hashmap

* Change code from struct to hashmap

* start working on update rate limits

* Remove wrong import

* Rename ChorusLibError to ChorusError

* Documented the chorus errors

* Made error documentation docstring

* Make ReceivedErrorCodeError have error string

* Remove unneeded import

* Match changes in errors.rs

* Improve update_rate_limits and can_send_request

* add ratelimits.to_hash_map()

* use instances' client instead of new client

* add LimitsConfiguration to instance

* improve update_limits, change a method name

* Fix un-updated errors

* Get LimitConfiguration in a sane way

* Move common.rs into ratelimiter::ChorusRequest

* Delete common.rs

* Make instance.rs use overhauled errors

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* update ratelimiter implementation across all files

* Fix remaining errors post-refactor

* Changed Enum case to be correct

* Use result

* Re-add missing body to request

* Remove unneeded late initalization

* Change visibility from pub to pub(crate)
I feel like these core methods don't need to be exposed as public API.

* Remove unnecessary import

* Fix clippy warnings

* Add docstring

* Change Error names across all files

* Update Cargo.toml

Strum is not needed

* Update ratelimits.rs

* Update ratelimits.rs

* Bug/discord instance info unavailable (#146)

* Change text to be more ambigous

* Use default Configuration instead of erroring out

* Emit warning log if instance config cant be gotten

* Remove import

* Update src/instance.rs

Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>

* Add missing closing bracket

* Put limits and limits_configuration as one struct

* Derive Hash

* remove import

* rename limits and limits_configuration

* Save clone call

* Change LimitsConfiguration to RateLimits
`LimitsConfiguration` is in no way related to whether the instance has API rate limits enabled or not. Therefore, it has been replaced with what it should have been all along.

* Add ensure_limit_in_map(), add `window` to `Limit`

* Remove unneeded var

* Remove import

* Clean up unneeded things
Dead code warnings have been supressed, but flagged as FIXME so they don't get forgotten. Anyone using tools like TODO Tree in VSCode can still see that they are there, however, they will not be shown as warnings anymore

* Remove nested submodule `limit`

* Add doc comments

* Add more doc comments

* Add some log messages to some methods

---------

Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-09 18:38:02 +02:00
kozabrada123 ce359103da Use log instead of prints 2023-07-01 19:29:50 +02:00
Vincent Junge 2e9d4caee5
require password to log in 2023-06-25 22:34:05 +02:00
Vincent Junge 9ccc08b5e2
remove client side validation 2023-06-25 11:36:37 +02:00
Flori Weber 70aaa238e3
Make ReactionMeta::get() return Vec<PublicUser> 2023-06-23 12:54:08 +02:00
Flori Weber f6d6daf1d2
Fix stupid multi line comments 2023-06-23 12:18:22 +02:00
Flori fe0c09b0e9
Merge pull request #130 from polyphony-chat/refactor/change-channel-modify
Refactor/change channel modify
2023-06-22 20:05:15 +02:00
Flori Weber 0aac291a3c
Remove wrongful match statement 2023-06-22 19:54:39 +02:00
Flori f554244143
Update src/api/channels/channels.rs
Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-06-22 19:42:07 +02:00
Flori Weber 1e0783e30e
Make Channel::modify() take &mut self 2023-06-22 18:56:16 +02:00
Vincent Junge f2709492de
always use Snowflakes in args 2023-06-22 18:55:19 +02:00
Vincent Junge 4117bcff59
ChorusResult type alias 2023-06-21 21:39:22 +02:00
Vincent Junge 8d7e49f3c2
get channel messages 2023-06-21 14:46:45 +02:00
Flori Weber e7eee4808e
Change send_request() calls to pass &mut Instance 2023-06-20 22:42:42 +02:00
Flori Weber 2233063d5f
Use Instance.client instead of creating a new one. 2023-06-20 22:42:08 +02:00
Flori Weber 27047ab909
Add reqwest::Client to chorus::Instance. 2023-06-20 22:41:31 +02:00
Flori Weber 3958f049ea
Change to single-line docstring 2023-06-20 22:36:39 +02:00
Flori Weber 0a523d54c1
Multiline docstring to single line docstring 2023-06-20 22:30:42 +02:00
Flori Weber 1fc38b25bf
Merge branch 'main' into refactor/reuse-reqwest-client 2023-06-20 22:21:08 +02:00
Flori Weber 915c9be4ad
Change docstring from multi- to singleline 2023-06-20 22:20:06 +02:00
Flori 6e50292f71
Merge pull request #122 from SpecificProtagonist/winter
More consistent use of snowflakes
2023-06-20 22:16:54 +02:00
Vincent Junge 9429bd7772
more consistent use of snowflakes 2023-06-20 22:03:29 +02:00
Flori 9725b165dd
Merge pull request #121 from polyphony-chat/fix/cannot-connect-to-discord
Remove unnecessary things
2023-06-20 21:54:53 +02:00
Flori 304cb6076a
Merge pull request #114 from SpecificProtagonist/snowflake
Simplify Snowflake
2023-06-20 18:57:25 +02:00
Flori dcacfacda9
Merge pull request #117 from SpecificProtagonist/gateway-event
Simplify GatewayEvent
2023-06-20 18:57:13 +02:00
kozabrada123 b8d7030ab1 Change Option<ChorusLibError> to Result<(), ChorusLibError> 2023-06-20 18:26:30 +02:00
Vincent Junge 04c3ee56e9
simplify GatewayEvent 2023-06-20 16:12:13 +02:00
Vincent Junge f614e93892
UrlBundle remove getters 2023-06-20 12:29:52 +02:00
Vincent Junge 29fcdfe641
simplyfy Snowflake 2023-06-20 12:21:22 +02:00
Flori Weber be7b9616c2
Remove unnecessary things 2023-06-20 00:35:46 +02:00
Flori Weber 603c8c8150
apply clippy suggestions 2023-06-19 19:01:18 +02:00
Flori Weber 17223d338a
change post to delete 2023-06-19 18:12:09 +02:00
Flori Weber 06b4f5fb65
Add Eq, PartialEq derives 2023-06-19 18:12:01 +02:00
Vincent Junge de5fe8aebf
Fix clippy::await_holding_refcell_ref false positives 2023-06-19 16:46:58 +02:00
Flori Weber b8e8a1c23a
Fix build failing 2023-06-19 16:11:53 +02:00
Vincent Junge cadf14ba6a
Make MessageSendSchema fields public 2023-06-19 14:21:27 +02:00
Vincent Junge 37de1d7b06
Fix various Clippy lints 2023-06-19 12:35:07 +02:00
Flori Weber a05241dd8e
Add remove_relationship 2023-06-18 23:10:29 +02:00
Flori Weber 6d8e0aaa39
Remove unneccessary imports 2023-06-18 23:04:25 +02:00
Flori Weber 636cb4c751
Add modify_user_relationship 2023-06-18 23:02:49 +02:00
Flori Weber 6878fd0380
Fix errors not displayed, add InvalidArgumentsErr 2023-06-18 23:01:38 +02:00
Flori Weber 4829845512
Move FriendRequestSchema to schemas 2023-06-18 19:05:09 +02:00
Flori Weber 191dc34933
Create relationship schemes 2023-06-18 19:04:55 +02:00
Flori Weber 0460a67bdd
Change returns, add documentation 2023-06-18 15:39:52 +02:00
Flori Weber fc6b431ad8
Start implementing get_relationship 2023-06-18 14:00:12 +02:00
Flori Weber cd303b0fef
Add FriendRequestSendSchema 2023-06-15 19:01:01 +02:00
Flori Weber e971ed2b49
Implement send_friend_request 2023-06-15 19:00:47 +02:00
Flori Weber 8378c5ccb6
Add get_mutual_relationships 2023-06-14 22:54:14 +02:00
Flori Weber 6312bd3572
Change belongs_to to be borrowed non-mutably 2023-06-14 22:53:56 +02:00
Flori Weber b56b5f5f12
Format relationships.rs 2023-06-14 22:14:56 +02:00
Flori Weber 2a8a8d75d3
Add relationships.rs 2023-06-14 22:14:48 +02:00
Flori Weber 870d5606a0
Update link reference 2023-06-13 15:23:39 +02:00
Flori Weber dfec24b8b8
Update relationship.rs types 2023-06-13 15:23:06 +02:00
Flori Weber bcc4069cea
Create relationships.rs 2023-06-13 14:04:58 +02:00
Flori Weber c6dcfff6a8
Create relationships.rs 2023-06-13 14:04:39 +02:00
bitfl0wer 8de2d3b5c3
run cargo fix 2023-06-12 18:59:06 +02:00
bitfl0wer 550d6d9265
run cargo fix 2023-06-12 18:58:53 +02:00
bitfl0wer 1aad39ded1
Remove unneccessary variable 2023-06-12 18:55:27 +02:00
bitfl0wer 98a043ab30
Refactor limited requester
The requester does not need to be instantiated anymore, which makes things easier to read imo.
2023-06-12 18:51:54 +02:00
Flori Weber 1910649ac4
Refactor users.rs to use api::common 2023-06-11 21:40:03 +02:00
Flori Weber 43e62359ae
Refactor roles.rs to use api::common 2023-06-11 20:04:40 +02:00
Flori Weber c03c3357fa
Refactor member.rs to use api::common 2023-06-11 19:30:15 +02:00
Flori Weber 3f8724535e
Refactor guilds.rs to use api:common 2023-06-11 19:26:34 +02:00
Flori Weber f6da3dcacf
Use handle_request_as_option instead 2023-06-11 19:22:28 +02:00
Flori Weber 3a8b6c8629
Introduce handle_request_as_option 2023-06-11 19:22:10 +02:00
Flori Weber fac9937bdd
Refactor reactions to use api::options 2023-06-11 19:13:38 +02:00
Flori Weber c479db36fb
Refactor permissions.rs to use api::common 2023-06-11 17:56:29 +02:00
Flori Weber 90ad75ae30
Remove import 2023-06-11 17:51:26 +02:00
Flori Weber ce004b3863
Refactor Message::send() 2023-06-11 17:49:42 +02:00
Flori Weber 583031e64f
Make some fields Option enum 2023-06-11 17:49:30 +02:00
Flori Weber 59d512cdce
Refactor to use api common, return Message instead 2023-06-11 17:40:44 +02:00
Flori Weber bf005c44a4
Refactor channels.rs to use api::common 2023-06-11 17:36:04 +02:00
Flori Weber 5d039c3e9b
Add argument to specify which LimitType to use 2023-06-11 17:35:47 +02:00
Flori Weber 9449c4cd4d
Move common request code into common.rs 2023-06-11 17:21:09 +02:00
Flori Weber ebe8a054e0
Merge branch 'main' into feature/permissions-and-roles 2023-06-11 15:34:43 +02:00
Flori Weber 3f7bf0c912
create common.rs 2023-06-11 15:34:05 +02:00
kozabrada123 dc5e91a784 Reformat and cargo fix 2023-06-11 14:32:37 +02:00
Flori Weber 8b8ea03513
Cargo fix 2023-06-11 13:55:00 +02:00
Flori Weber 41135d037f
Cargo fix 2023-06-11 13:54:54 +02:00
Flori Weber f585e0ddae
Reformat entire project, optimize imports 2023-06-11 13:52:53 +02:00
Flori Weber f4e0d520b1
Reformat entire project, optimize imports 2023-06-11 13:52:31 +02:00
kozabrada123 f5bbd3d737 Merge branch 'main' into perpetual/gateway-dev 2023-06-11 09:10:03 +02:00
bitfl0wer 6952f9977f
Implement delete_permission 2023-06-10 22:16:53 +02:00
bitfl0wer 87e70181fb
impl Channel::edit_permissions() 2023-06-10 22:09:53 +02:00
bitfl0wer 48a063838b
Create permissions.rs 2023-06-10 21:51:45 +02:00
Flori Weber e5aff12f94
"Normalize" RolePositionUpdateSchema 2023-06-10 19:35:57 +02:00
Flori Weber 5b66464ce9
Better error handling in get methods. 2023-06-10 18:50:49 +02:00
Flori Weber a9b02bad78
Implement RoleObject::get() 2023-06-10 18:48:37 +02:00
Flori Weber 9a6ac33a40
Add RoleObject::update() 2023-06-10 18:42:37 +02:00
kozabrada123 94ec90b924 Implement display for UserStatus 2023-06-10 16:56:50 +02:00
kozabrada123 330a4347d3 turns out UpdatePresence and PresenceUpdate are different events 2023-06-10 16:32:42 +02:00
kozabrada123 57d2d93420 Change observer update ref to &mut from & 2023-06-10 15:37:02 +02:00
Flori Weber d5e38d954f
Implement GuildMember::get() 2023-06-10 15:16:45 +02:00
kozabrada123 a148cf576e Refactor, better deserialization error handling 2023-06-10 12:43:07 +02:00
kozabrada123 0b06f914e3 Merge branch 'main' into perpetual/gateway-dev 2023-06-10 10:30:54 +02:00
bitfl0wer a18eab1884
Change UserMeta: User instead of Option<User>
I do not know why I have made it optional in the first place. hm
2023-06-10 00:35:51 +02:00
bitfl0wer 30db9e9553
implement GuildMember::remove_role() 2023-06-10 00:10:12 +02:00
bitfl0wer 3d98b45413
Implement GuildMember::add_role() 2023-06-10 00:03:31 +02:00
bitfl0wer daf30ddde6
create member.rs 2023-06-09 23:41:40 +02:00
bitfl0wer 7aa948647a
Add from_vec()
Calculates a PermissionFlags Stirng from a Vec<PermissionFlags>.
2023-06-09 21:34:54 +02:00
bitfl0wer 7a0a9baa45
Remove unused import 2023-06-09 20:49:02 +02:00
bitfl0wer 486e210062
Move role schemas to own file 2023-06-09 20:47:45 +02:00
kozabrada123 5231656c68 Docs + unneeded &mut 2023-06-09 20:22:59 +02:00
kozabrada123 28877f8355 Discord.com sends premissions as an integer 2023-06-09 18:38:36 +02:00
kozabrada123 182cd45a15 Rebase 2023-06-09 18:14:20 +02:00
bitfl0wer d475584fea
Implement RoleObject::position_update() 2023-06-09 16:50:03 +02:00
bitfl0wer 9bf968c7e0
Change Role to have String over PermissionFlags
PermissionFlags implementation needs to be figured out a bit better before we can use it here.
2023-06-09 12:04:49 +02:00
bitfl0wer fc66036674
Add documentation 2023-06-08 22:39:06 +02:00
bitfl0wer 30cfb3b744
Implement RoleObject::create() 2023-06-08 22:26:24 +02:00
bitfl0wer 1c5be5693e
Add FormCreationError 2023-06-08 22:26:08 +02:00
bitfl0wer 9f21c06492
Change InstanceServerError to ChorusLibError
The name InstanceServerError was chosen without thinking about it too much, very early in development. The new name suits this custom Error type way better, in my opinion.
2023-06-08 22:16:23 +02:00
bitfl0wer bac097fb2e
Add RolePositionUpdateSchema 2023-06-08 20:45:56 +02:00
bitfl0wer 4993b7bac8
Change struct name
This schema is being used as a RoleModifySchema AND as a RoleCreationSchema.
2023-06-08 20:43:29 +02:00
bitfl0wer a1a4532b57
Add misssing attribute 2023-06-08 20:42:40 +02:00
bitfl0wer c31d2aa76d
Add RoleCreateSchema 2023-06-08 20:40:36 +02:00
kozabrada123 e6af81d694 Basic tests 2023-06-08 19:51:32 +02:00
kozabrada123 cae038af8f Refactor 2023-06-08 18:24:11 +02:00
kozabrada123 0f4eef2fb9 Merge branch 'main' into perpetual/gateway-dev 2023-06-08 17:35:17 +02:00
kozabrada123 f4f17f7454 Gateway basic error handling 2023-06-08 17:34:52 +02:00
bitfl0wer 429db9332b
cargo fix 2023-06-07 23:06:52 +02:00
bitfl0wer 0097809049
Remove unnecessary imports 2023-06-07 23:03:37 +02:00
bitfl0wer 32503078d7
Implement RoleObject::get_all() 2023-06-07 23:03:24 +02:00
bitfl0wer afe9663ded
Create roles.rs 2023-06-07 23:03:07 +02:00
bitfl0wer 97ca0c17eb
Try making permissions to PermissionFlags 2023-06-07 22:44:16 +02:00
bitfl0wer 6c0d21867c
Sort fields on Guild alphabetically 2023-06-07 22:40:48 +02:00
bitfl0wer 5b7bfa4a5d
Make enum into bitflags struct 2023-06-07 10:39:05 +02:00
bitfl0wer 7a1021031e
Fix enum, add has_permission() for RoleObject 2023-06-06 21:38:28 +02:00
bitfl0wer e2c80fc1f8
Make enum pub 2023-06-06 20:10:50 +02:00
bitfl0wer 6d2db3d808
Add PermissionFlags 2023-06-06 20:05:34 +02:00
bitfl0wer 7a3f485580
Add reference to docs 2023-06-04 14:41:24 +02:00
bitfl0wer 471abc88a6
Add method to remove own reaction 2023-06-04 14:39:22 +02:00
bitfl0wer fd2b9e670f
improve existing documentation 2023-06-04 14:32:57 +02:00
bitfl0wer 213220c8e0
Add delete_user method 2023-06-04 14:29:43 +02:00
bitfl0wer 47d1c52014
Change file structure 2023-06-04 14:20:06 +02:00
kozabrada123 7d17a1c976 Implement Clone for all events 2023-06-04 13:49:35 +02:00
kozabrada123 ca9f7f6c11 Merge branch 'main' into perpetual/gateway-dev 2023-06-04 10:18:16 +02:00
bitfl0wer 6b8d458eb4
Move some pieces of documentation to where they make the most sense 2023-06-03 22:34:03 +02:00
bitfl0wer f2de0f8813
Make reference links clickable in cargo doc 2023-06-03 22:15:03 +02:00
bitfl0wer 5967858e81
Add references 2023-06-03 22:08:56 +02:00
bitfl0wer 3722536de2
Add create reaction with documentation 2023-06-03 22:07:37 +02:00
bitfl0wer 5b579c551a
Add delete_emoji method with documentation 2023-06-03 20:17:21 +02:00
bitfl0wer 02db71055c
Add documentation 2023-06-03 18:59:13 +02:00
bitfl0wer 4f91f26a28
Add reactions: get 2023-06-03 18:53:53 +02:00
bitfl0wer fab9bc1c62
Implement reactions: delete all 2023-06-03 18:46:36 +02:00
bitfl0wer addfb01075
Add ReactionMeta struct 2023-06-03 15:21:49 +02:00
kozabrada123 63ae7feb8a Features is not always sent 2023-06-02 11:00:34 +02:00
kozabrada123 a49bdd8456 Merge branch 'perpetual/gateway-dev' of https://github.com/polyphony-chat/chorus into perpetual/gateway-dev 2023-06-02 10:58:22 +02:00
kozabrada123 e846b2b423 fmt 2023-06-02 10:58:04 +02:00
kozabrada123 611ee800ba Handle Heartbeat ACKs 2023-06-02 10:57:47 +02:00
kozabrada123 28a92212b6 Handle Heartbeat requests 2023-06-02 10:42:19 +02:00
bitfl0wer e4a185dce5
Create reactions.rs 2023-06-01 21:14:11 +02:00
bitfl0wer 4bdecb0a6c
Remove mod 2023-06-01 21:14:02 +02:00
Flori b87ac84f61
Merge pull request #83 from polyphony-chat/refactor/less-boilerplate
Refactor/less boilerplate
2023-05-30 23:11:47 +02:00
bitfl0wer dc40c69ebe
Refactored users() as much as possible 2023-05-30 23:04:22 +02:00
Zertex 5a9a156846 make the tests pass 2023-05-30 10:57:34 -04:00
Zert3x 25a0544822
Merge branch 'main' into refactor/rename-apierror 2023-05-29 22:25:02 -04:00
bitfl0wer b1dbc53049
Refactor channels() 2023-05-29 23:59:13 +02:00
bitfl0wer 3cebafecf6
Refactor create 2023-05-29 23:57:23 +02:00
bitfl0wer d8d3bf5be6
Refactor delete() 2023-05-29 23:51:12 +02:00
bitfl0wer 96ace34137
Refactor create() and get() 2023-05-29 23:46:43 +02:00
bitfl0wer e03c51658d
Remove unnecessary lifetime 2023-05-29 23:46:17 +02:00
bitfl0wer eaf45274a6
Refactor Guild create 2023-05-29 23:16:43 +02:00
bitfl0wer 1e79a1a7ab
Refactor message::send() 2023-05-29 23:15:05 +02:00
bitfl0wer a12573fe1c
Refactor modify() to take less boilerplate args 2023-05-29 23:11:12 +02:00
bitfl0wer 808224d4fb
Refactor delete() to take less boilerplate args 2023-05-29 23:08:52 +02:00
bitfl0wer 001dc9f80c
Refactor get() to take less boilerplate args 2023-05-29 23:01:17 +02:00
bitfl0wer f18d3d7707
Add clone, default derives 2023-05-29 18:50:19 +02:00
bitfl0wer a7fd29c7f1
Make all attributes pub 2023-05-29 18:34:08 +02:00
bitfl0wer 05bc4a4647
Add modify() 2023-05-29 18:27:30 +02:00
bitfl0wer 0048e548f5
Add ChannelModifySchema 2023-05-29 18:27:15 +02:00
Flori 9c258067e8
Merge pull request #81 from polyphony-chat/feature/channel/delete
Feature/channel/delete
2023-05-29 17:56:13 +02:00
bitfl0wer 5a40da1cd6
Implement User methods on User instead of UserMeta 2023-05-29 17:25:34 +02:00
kozabrada123 b83dd916e8 Fix typo 2023-05-29 17:18:52 +02:00
kozabrada123 90ebc823ba Fix some errors caused by the observer return fix 2023-05-29 17:11:08 +02:00
bitfl0wer 7f8abceab5
Made Guild::create return Guild instead of String.
This makes way more sense, I think.
2023-05-29 16:50:10 +02:00
bitfl0wer fee0aa966a
Changed some apparently incorrect attributes
Some attributes are not necessarily returned by the GET route for a guild. Also, some integers were too small. One example is max_video_channel_users, which was a u8, but could theoretically be a value much higher than u8::MAX.
2023-05-29 16:49:36 +02:00
bitfl0wer b2b5930db0
Remove print statement 2023-05-28 23:08:13 +02:00
bitfl0wer 135782da9f
Remove print statement 2023-05-28 23:08:05 +02:00
bitfl0wer 7b7dbb9b5e
Create channels() for Guild
This method retrieves all channels from a guild
2023-05-28 23:04:35 +02:00
bitfl0wer 897c269e98
Make delete use self 2023-05-28 23:04:13 +02:00
bitfl0wer 5db5a2562f
Add InvalidResponseError 2023-05-28 23:04:02 +02:00
bitfl0wer 2ba1e1ac84
Add documentation 2023-05-28 22:40:37 +02:00
bitfl0wer 69b6efe200
Make channel delete take ownership of a Channel 2023-05-28 22:39:38 +02:00
bitfl0wer 268da9525c
Add channel delete method 2023-05-28 22:39:25 +02:00
kozabrada123 c4a6b85e1e Fix weird observer subscribe return 2023-05-28 17:37:05 +02:00
kozabrada123 982e85af9e u16 is too small for flags apparently 2023-05-28 17:36:30 +02:00
kozabrada123 61a54678cb Members is optional 2023-05-28 17:36:12 +02:00
kozabrada123 a1a0c94e2d agjbg??! 2023-05-28 14:52:48 +02:00
kozabrada123 dfa047a9c5 71 conflicts due to fmt?!?!?!?! 2023-05-28 14:52:08 +02:00
kozabrada123 b6061b7bf5 Gateway opcode constants and small refactor 2023-05-28 14:39:41 +02:00
kozabrada123 304ff014e3 More stability 2023-05-28 08:43:22 +02:00
Zertex de10ccbed7 Hijack this to make User::flags pub 2023-05-28 02:42:35 -04:00
Zertex bab1f0ed52 Add custom implementation to allow simple-array behaviour for GuildFeatures 2023-05-28 02:42:09 -04:00
Zertex 73790fbf2a Change integer datatypes to be 'i32' as required by sqlx 2023-05-28 02:39:24 -04:00
kozabrada123 504d74a715 Stability, new event 2023-05-28 08:18:50 +02:00
Zertex c300f1918c merge main 2023-05-27 19:54:43 -04:00
bitfl0wer 77ae3f10b6
run cargo fmt && cargo fix 2023-05-28 00:50:52 +02:00
bitfl0wer 503edf2fac
Move test to tests-dir 2023-05-27 22:51:43 +02:00
bitfl0wer 1e844445fc
Remove empty test 2023-05-27 22:47:46 +02:00
bitfl0wer 8ea0cc3f3f
Make password optional 2023-05-27 22:46:43 +02:00
bitfl0wer 927109e9b6
Move tests to tests/-dir 2023-05-27 22:46:27 +02:00
bitfl0wer a7d092fc3a
Fix build 2023-05-27 20:54:43 +02:00
bitfl0wer 0504f0a9d2
Merge branch 'refactor/application-default' 2023-05-27 20:46:19 +02:00
kozabrada123 f54e750f74 Add options with empty string for identify props 2023-05-27 19:55:57 +02:00
Zertex 80e60901d8 uncomment, oops 2023-05-27 13:50:55 -04:00
Zertex 665a3b3667 rename APIError in ErrorField vec as well 2023-05-27 13:50:28 -04:00
Zertex 7189294d4b Hijack this to clean up ApplicationCommandOptionType with serde_repr 2023-05-27 13:46:37 -04:00
Zertex 250035fe9e Add custom Default impl to Application 2023-05-27 13:45:56 -04:00
Zertex 6d747bc504 Rename APIError -> APIErrorPayload to solve conflicting name 2023-05-27 13:41:23 -04:00
bitfl0wer da9232da0b
Fix typos 2023-05-27 19:36:07 +02:00
kozabrada123 a26ded8ab2
Merge branch 'main' into feature/full-gateway-coverage 2023-05-27 19:23:27 +02:00
Zertex 7a487c657c remove message field 2023-05-27 11:40:20 -04:00
kozabrada123 f8c02fee6a Remove dumping gateway events into stdout 2023-05-27 17:33:19 +02:00
kozabrada123 4a7fea8366 Better unrecognised messages 2023-05-27 17:31:55 +02:00
kozabrada123 be73bf19eb Add Application Command Permissions & Update event 2023-05-27 17:29:30 +02:00
kozabrada123 15ffdcecaa Add InteractionCreate 2023-05-27 17:11:47 +02:00
kozabrada123 5b04370d46 Add Stage Instance & events 2023-05-27 17:05:25 +02:00
kozabrada123 8d0083e11d Add Auto Moderation types & events 2023-05-27 16:50:38 +02:00
kozabrada123 ab902c5ef2 Add Relationship & related events 2023-05-27 16:03:23 +02:00
kozabrada123 7367475d99 Add "Discord Client" option 2023-05-27 13:16:40 +02:00
kozabrada123 b11743d35c Document more gateway props options 2023-05-27 13:05:59 +02:00
kozabrada123 224b3159a6 Fix some deserialization errors 2023-05-27 13:05:36 +02:00
kozabrada123 21c4d53b28 Fix a types mismatch 2023-05-27 09:58:10 +02:00
kozabrada123 b102f3d2cc Fix stack overflow due to infinite recursion
I am dumb
2023-05-27 09:57:46 +02:00
kozabrada123 5b08ddfcfb Add a sensible defaults for Identify and its props 2023-05-27 09:21:26 +02:00
Zertex 5e000f3617 Revert "Add back settings and extended_settings fields to User"
This reverts commit 3018c0ddd1.
2023-05-27 00:24:37 -04:00
Zertex 9974d90416 Revert "fix imports"
This reverts commit 13c2e4aed9.
2023-05-27 00:24:32 -04:00
Zertex 13c2e4aed9 fix imports 2023-05-27 00:12:05 -04:00
Zertex 3018c0ddd1 Add back settings and extended_settings fields to User 2023-05-27 00:07:07 -04:00
Zertex b8e5b627de Add PartialEq, Clone, Copy to Component 2023-05-26 22:44:43 -04:00
Zertex 342354a06b Add forgotten derives to UnvailableGuild/GuildCreateResponse 2023-05-26 22:38:39 -04:00
Zertex 185480b0be Add forgotten feature lock to UserTheme 2023-05-26 22:38:16 -04:00