aboutsummaryrefslogtreecommitdiff
path: root/src/model
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge v0.4.2acdenisSK2017-10-248-11/+90
|\ \
| * | Fall back to `str::parse` if `parse_username` failsacdenisSK2017-10-241-3/+4
| |/
| * Fix User::has_roleZeyla Hellyer2017-10-241-1/+5
| | | | | | | | | | | | | | | | | | Fix the return value of the function by properly checking whether the user has the role in the given guild. The function made the erraneous mistake of simply checking if the given guild had the role by Id, not whether the _member in the given guild_ had the role by Id.
| * Properly update emojis, fix shard retries, fix csLakelezz2017-10-231-1/+3
| | | | | | | | | | | | | | * If a guild's emojis are being altered, Serenity will straight up use the new `HashMap` instead of just extending. If `connect()` returns an `Err`, it will retry connecting. Cleaned up `help_command.rs`.
| * Deprecate some text-only Channel methodsZeyla Hellyer2017-10-191-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some methods on `model::Channel` are only for text channels. Methods on Channel should be applicable to all channel types. Deprecates the following methods on `model::Channel`: - `create_reaction` - `delete_message` - `delete_reaction` - `edit_message` - `message` - `messages` - `reaction_users` - `say` - `send_files` - `send_message` - `unpin`
| * Implement changing a role's position (#201)Ken Swenson2017-10-192-0/+41
| |
| * Use the underlaying integer value of a `ChannelType` variantacdenisSK2017-10-171-1/+1
| |
| * defer to `delete_message` if there's just one message to deleteacdenisSK2017-10-162-4/+8
| |
| * Hash and do equality on just the id for `User`acdenisSK2017-10-151-1/+17
| |
* | Remove `on_` prefix to EventHandler tymethodsZeyla Hellyer2017-10-226-10/+10
| | | | | | | | | | It was voted that the `on_` prefix is unnecessary, so these have been dropped.
* | Change CreateEmbed::field{,s} to not take buildersZeyla Hellyer2017-10-181-4/+19
| | | | | | | | | | | | | | | | | | Change the `field` and `fields` methods on `builder::CreateEmbed` to not accept a `CreateEmbedField` builder. The embed field builder realistically only had (and most likely, only will) have one optional argument, so the parameters may as well be on `CreateEmbed::field`.
* | Slightly improve performance of buildersZeyla Hellyer2017-10-1810-62/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Builders would keep a `serde_json::Map<String, Value>`, which would require re-creating owned strings for the same parameter multiple times in some cases, depending on builder defaults and keying strategies. This commit uses a `std::collections::HashMap<&'static str, Value>` internally, and moves over values to a `serde_json::Map<String, Value>` when it comes time to sending them to the appropriate `http` module function. This saves the number of heap-allocated string creations on most builders, with specific performance increase on `builder::CreateMessage` and `builder::CreateEmbed` & co.
* | Fix some compilation feature targets, fix lintsZeyla Hellyer2017-10-172-1/+6
| |
* | Change `features` fields to be a Vec<String>Zeyla Hellyer2017-10-143-30/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When Discord adds new features, the Feature enum will not be able to serialize the new values until updated, causing the entire Guild deserialization to fail. Due to the fact that these features can be added at any time, the `features` vector on Guild and PartialGuild have been changed to be a `Vec<String>`. Upgrade path: Instead of matching on variants of Feature like so: ```rust use serenity::model::Feature; for feature in guild.features { if feature == Feature::VipRegions { // do work with this info } } ``` Instead opt to check the string name of the feature: ```rust for feature in guild.features { if feature == "VIP_REGIONS" { // do work with this info } } ```
* | Update to account for changes made in 0.4.1acdenisSK2017-10-145-62/+251
|\|
| * Add try_opt macro for substituteMei Boudreau2017-10-121-4/+1
| |
| * Optimize Member::rolesMei Boudreau2017-10-121-21/+11
| |
| * Fix clippy lintsZeyla Hellyer2017-10-114-48/+48
| |
| * Variety of methods to search for `Member`. (#187)Lakelezz2017-10-101-12/+218
| |
| * Generate `Default` for CurrentUser and use it in `Cache::default`acdenisSK2017-10-082-2/+2
| |
| * Add an impl for `&str`acdenisSK2017-10-081-0/+4
| |
| * Find `Member` via substrings, allow case-insensitivity on ↵Lakelezz2017-10-071-4/+54
| | | | | | | | `members_containing` and `members_starting_with` (#184)
| * Help-commands filtering and Member-prefix-search (#182)Lakelezz2017-10-071-0/+18
| |
| * Fix a typoacdenisSK2017-10-051-1/+1
| |
| * Add an andacdenisSK2017-10-051-1/+1
| |
| * Use an as_ref hackacdenisSK2017-10-053-3/+10
| |
| * Replace slice parametres by IntoIterator (#177)François Triquet2017-10-054-4/+4
| | | | | | Fixes #174
| * Fix most clippy warningsMaiddog2017-10-042-2/+2
| |
| * Replace Vec parameters by IntoIterator (#176)François Triquet2017-10-045-5/+5
| |
| * Revert "Use the de-generification trick."acdenisSK2017-10-039-190/+55
| | | | | | | | Makes the compiliation time just a bit worse
| * Use the de-generification trick.acdenisSK2017-10-029-55/+190
| | | | | | | | Fixes #168
| * `to_owned` -> `to_string`acdenisSK2017-10-0111-29/+29
| |
* | Switch to parking_lot::{Mutex, RwLock}Zeyla Hellyer2017-10-1016-159/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch to the `parking_lot` crate's implementations of `std::sync::Mutex` and `std::sync::RwLock`, which are more efficient. A writeup on why `parking_lot` is more efficient can be read here: <https://github.com/Amanieu/parking_lot> Upgrade path: Modify `mutex.lock().unwrap()` usage to `mutex.lock()` (not needing to unwrap or handle a result), and `rwlock.read().unwrap()`/`rwlock.write().unwrap()` usage to `rwlock.read()` and `rwlock.write()`. For example, modify: ```rust use serenity::CACHE; println!("{}", CACHE.read().unwrap().user.id); ``` to: ```rust use serenity::CACHE; println!("{}", CACHE.read().user.id); ```
* | Resume on resumable session invalidationsZeyla Hellyer2017-10-091-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Session invalidations include whether the session may be resumable. Previously, this was not parsed by serenity. This data is now contained in `GatewayEvent::InvalidateSession` as a boolean, which constitutes a breaking change for users that manually handle gateway events. Upgrade path: Instead of pattern matching on simply the variant like so: ```rust use serenity::model::event::GatewayEvent; match gateway_event { GatewayEvent::InvalidateSession => { // work here }, // other matching arms here _ => {}, } ``` Instead pattern match it as a single field tuple-struct: ```rust use serenity::model::event::GatewayEvent; match gateway_event { GatewayEvent::InvalidateSession(resumable) => { // work here }, // other matching arms here _ => {}, } ```
* | Generate `Default` for CurrentUser and use it in `Cache::default`acdenisSK2017-10-092-2/+2
| |
* | Add an impl for `&str`acdenisSK2017-10-091-0/+4
| |
* | Find `Member` via substrings, allow case-insensitivity on ↵Lakelezz2017-10-091-4/+54
| | | | | | | | `members_containing` and `members_starting_with` (#184)
* | Help-commands filtering and Member-prefix-search (#182)Lakelezz2017-10-091-0/+18
| |
* | Fix a typoacdenisSK2017-10-091-1/+1
| |
* | Add an andacdenisSK2017-10-091-1/+1
| |
* | Use an as_ref hackacdenisSK2017-10-093-3/+10
| |
* | Replace slice parametres by IntoIterator (#177)François Triquet2017-10-094-4/+4
| | | | | | Fixes #174
* | Fix most clippy warningsMaiddog2017-10-092-2/+2
| |
* | Replace Vec parameters by IntoIterator (#176)François Triquet2017-10-095-5/+5
| |
* | Revert "Use the de-generification trick."acdenisSK2017-10-099-190/+55
| | | | | | | | Makes the compiliation time just a bit worse
* | Use the de-generification trick.acdenisSK2017-10-099-55/+190
| | | | | | | | Fixes #168
* | `to_owned` -> `to_string`acdenisSK2017-10-0911-29/+29
| |
* | Change behaviour of default_channel (#185)Mei Boudreau2017-10-072-8/+25
| |
* | Change default_channel to return a pointer (#179)Mei Boudreau2017-10-052-6/+8
|/
* Fix User::tag and CurrentUser::tag discrim outputZeyla Hellyer2017-09-281-1/+1
| | | | | The output in a tag may result in "username#304" instead of the correct "username#0304".