aboutsummaryrefslogtreecommitdiff
path: root/src/model/guild
Commit message (Collapse)AuthorAgeFilesLines
* Add Member::user_idZeyla Hellyer2018-09-051-0/+14
| | | | | Adds a `user_id` method to `Member`, which is a shortcut for retrieving the member's user ID.
* Use `to_`- and `as_`-methods instead of `get` and `find` on Id newtypesLakelezz2018-08-125-17/+66
|
* Fix all the dead links in the docsErk-2018-08-096-163/+159
|
* Add From impls for Game, generify Game paramsZeyla Hellyer2018-08-011-1/+0
| | | | | Add more `impl From<T> for Game` implementations, and make `Into<Game>` trait bounds for all function parameters accepting a Game.
* Move unit tests into sourceZeyla Hellyer2018-08-011-0/+107
| | | | | | | | | Move the unit tests into the relevant source files. There's no need for them to be seprate, especially when the `tests` directory is meant to be for integration tests. The deserialization tests that include JSON files are still in the `tests` dir, along with the public prelude re-export tests.
* Make GuildId::member use the cache when possible (#356)Maiddog2018-07-311-1/+11
|
* Fix some clippy lintsZeyla Hellyer2018-07-152-12/+12
| | | | | Some lints were not resolved due to causing API changes. Most lints in the framework were left unfixed.
* Fix doc links with no anchorZeyla Hellyer2018-07-111-0/+3
|
* Monomorphize all functionsZeyla Hellyer2018-07-043-31/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit monomorphizes all functions, turning functions like: ```rust fn foo<T: Into<Bar>>(baz: T) { baz = baz.into(); // function here } ``` Into functions like: ```rust fn foo<T: Into<Bar>>(baz: T) { _foo(baz.into()) } fn _foo(baz: Bar) { // function here } ``` This avoids binary bloat and improves build times, by reducing the amount of code duplication.
* Remove extraneous spaces at the end of linesZeyla Hellyer2018-06-172-4/+4
|
* Remove deadlocking in Member::highest_role_infoZeyla Hellyer2018-05-271-8/+6
| | | | | | Instead of calling `parking_lot::RwLock::read` on the member's guild, call `parking_lot::RwLock::try_read` and return None early if it would cause a deadlock.
* Add `Message::member` structfieldZeyla Hellyer2018-05-211-2/+20
| | | | | Adds the `Message::member` structfield, which contains a partial amount of member data (deaf and mute status, role IDs, and joined_at).
* Get rid of a spurious import warningacdenisSK2018-04-201-4/+3
|
* make `Options`'s fields optional (#305)Kyle Clemens2018-04-121-15/+60
|
* Turn the number-like properties of `Options` into `u64`acdenisSK2018-04-111-38/+45
|
* Handle (de)serializing `target_id` from/to a stringacdenisSK2018-04-111-2/+37
|
* Refactor imports/exports to use nested groups and better formattingacdenisSK2018-03-293-6/+23
|
* Change the way ids and some enums are made (#295)Leah2018-03-231-53/+81
| | | | | This makes them easier to be found by tools like rls. Also update struct inits to use the shorthand version for `x: x`.
* Add 'Get Guild Vanity Url' endpointZeyla Hellyer2018-02-093-0/+30
| | | | Docs: <https://github.com/discordapp/discord-api-docs/commit/98f6643703012d2f3780ba730ce1191120f85dcd>
* Fix broken docs links caused by model mod changesZeyla Hellyer2018-01-311-1/+1
| | | | | Fix broken links caused by the `model` module changes in v0.5.0, which split up the module into sub-modules for better organization.
* Reduce number of clones in the libraryZeyla Hellyer2018-01-271-16/+18
|
* Correctly set role's position on new rolesZeyla Hellyer2018-01-271-1/+7
| | | | | | When creating a new role, correctly set its position if a position was specified. This is because the "Create Role" endpoint no longer accepts a `position` key.
* Add functions to reorder a guild's channelsZeyla Hellyer2018-01-272-0/+28
| | | | | Add `http::edit_guild_channel_positions`, `Guild::reorder_channels`, and `GuildId::reorder_channels`.
* Account for guild owners in member hierarchy checkZeyla Hellyer2018-01-271-0/+15
| | | | | | When using `Guild::greater_member_hierarchy`, check if both user IDs are the same (returning None) or if one of them is the guild owner, in which case the guild owner's ID is returned.
* Fix no-cache compilationacdenisSK2018-01-201-0/+1
|
* Fix no-model compiler warningsZeyla Hellyer2018-01-101-1/+1
|
* Allow channels to be moved in and out of a category (#248)Kyle Clemens2018-01-083-8/+12
|
* Fix compilationZeyla Hellyer2018-01-062-6/+5
|
* Add some role position hierarchy checksZeyla Hellyer2018-01-062-8/+27
|
* Add Guild::greater_member_hierarchyZeyla Hellyer2018-01-061-0/+47
| | | | | Add a function to determine which of two members has the higher role hierarchy.
* Add Member::highest_role_infoZeyla Hellyer2018-01-061-0/+40
|
* Fix permission overwrites in permission buildingZeyla Hellyer2018-01-051-1/+11
| | | | | | | | | | | | | | While building permissions in the `Guild::permissions_in` function - which is relied upon by most model functions to check CurrentUser permissions - the channel overwrites of the given channel were iterated over incorrectly. The channel overwrites were iterated over in a non-specified order, resulting in overwrites being applied in a random order. However, Discord operates by applying permissions from a down-top order: role ID 0 is below role ID 1, which is below role ID 2, etc. This means that prior to applying permissions we must first sort by position so that lower positioned roles are iterated over first.
* Implement or derive Serialize on all modelsZeyla Hellyer2018-01-017-19/+126
|
* Improve performance of builders even furtheracdenisSK2017-12-272-7/+7
| | | | | | By negating hashing altogether. The increase is around 1000-ish nanoseconds saved.
* Fix Guild::member_named and add teststahahawa2017-12-241-8/+15
| | | | | | | Use rfind, in case there's more '#' in username than just the discriminator Split at pos+1 instead of pos and remove the trailing '#' in the split.0 (Name) Fix bug with parsing
* Update model to include new voice regions (#240)Ken Swenson2017-12-231-0/+8
|
* Add `animated` to `Emoji` and `ReactionType`Zeyla Hellyer2017-12-201-0/+7
| | | | | | | | | | Adds an animated structfield to `Emoji` and `ReactionType`'s `Custom` variant, which defaults to false if not present. A test has been added for deserializing it, taken from a REST API GET Emojis response. (cherry picked from commit 5286949f424e824784344ebb7b7af4e52fb819c3)
* Fix `Guild` deser without `system_channel_id`Zeyla Hellyer2017-12-171-4/+4
| | | | | | | Fix the deserialization of `model::guild::Guild` when `Guild::system_channel_id` is not present. Additionally, add a test case for this.
* Fix most clippy lints, take more refeerncesZeyla Hellyer2017-12-164-8/+9
| | | | | Fix clippy lints and subsequently accept references for more function parameters.
* Break up the model moduleZeyla Hellyer2017-12-167-24/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `model` module has historically been one giant module re-exporting all of the model types, which is somewhere around 100 types. This can be a lot to look at for a new user and somewhat overwhelming, especially with a large number of fine-grained imports from the module. The module is now neatly split up into submodules, mostly like it has been internally since the early versions of the library. The submodules are: - application - channel - error - event - gateway - guild - id - invite - misc - permissions - prelude - user - voice - webhook Each submodule contains types that are "owned" by the module. For example, the `guild` submodule contains, but not limited to, Emoji, AuditLogsEntry, Role, and Member. `channel` contains, but not limited to, Attachment, Embed, Message, and Reaction. Upgrade path: Instead of glob importing the models via `use serenity::model::*;`, instead glob import via the prelude: ```rust use serenity::model::prelude::*; ``` Instead of importing from the root model module: ```rust use serenity::model::{Guild, Message, OnlineStatus, Role, User}; ``` instead import from the submodules like so: ```rust use serenity::model::channel::Message; use serenity::model::guild::{Guild, Role}; use serenity::model::user::{OnlineStatus, User}; ```
* Fix deserialization of `Guild::application_id`Zeyla Hellyer2017-12-151-2/+2
| | | | | | | Fix the deserialization of the `Guild::application_id` structfield. Additionally, create a new ID type for it. A test has been added for this.
* Change type of a couple Guild/PartialGuild fieldsZeyla Hellyer2017-12-152-6/+44
| | | | | | Changes the types of `Guild` and `PartialGuild`'s `default_message_notifications` and `mfa_level` structfields to be a bit more type-strong.
* Add missing fields to Guild modelZeyla Hellyer2017-12-151-0/+46
| | | | | | | | Adds the following missing fields to the Guild model: - `application_id` - `explicit_content_filter` - `system_channel_id`
* Convert from macro to ? (#226)Mei Boudreau2017-11-231-1/+1
|
* Re-order use statements alphabeticallyZeyla Hellyer2017-11-116-23/+19
|
* Whoops. Add a `FromStr` impl for `ReactionType`acdenisSK2017-11-042-7/+7
|
* Merge v0.4.3acdenisSK2017-11-042-41/+86
|\
| * Make Member::permissions return guild permissionsZeyla Hellyer2017-10-311-11/+3
| | | | | | | | | | | | Fixes what is realistically a bug where `Member::permissions` would retrieve the permissions for the Member in the default channel of the guild. This now only returns the guild-level permissions of the member.
| * Rename `Guild::permissions_for`->`permissions_in`Zeyla Hellyer2017-10-302-5/+16
| | | | | | | | | | | | Rename `Guild::permissions_for` to `Guild::permissions_in`, deprecating `Guild::permissions_for` which is only an inline method to `permissions_in`.
| * Guild::has_perms: use Guild::member_permissionsZeyla Hellyer2017-10-301-22/+14
| | | | | | | | | | | | Make `Guild`'s internal method `has_perms` go through `Guild::member_permissions` to check permissions, since all method that use it don't need channel-specific permissions.