aboutsummaryrefslogtreecommitdiff
path: root/src/model/channel/guild_channel.rs
Commit message (Collapse)AuthorAgeFilesLines
* Monomorphize all functionsZeyla Hellyer2018-07-041-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix nsfw related docs (#299)Lakelezz2018-04-041-7/+7
|
* Refactor imports/exports to use nested groups and better formattingacdenisSK2018-03-291-2/+12
|
* Check message ID count in `delete_messages`Zeyla Hellyer2018-01-271-3/+6
| | | | | | In models' `delete_messages` methods, check the number of messages being deleted. If 0 or more than 100, return a `ModelError::BulkDeleteAmount`, as this amount would result in an invalid request.
* Fix compilation for some feature combinationsZeyla Hellyer2018-01-201-0/+2
|
* Add an `EditMessage` builderZeyla Hellyer2018-01-181-5/+5
| | | | | | When editing messages, not all fields are applicable. Attachments, TTS, and reactions are not applicable. To help with this distinction, separate message editing into a different builder.
* Further generic-ify `reaction_users` `after` paramZeyla Hellyer2018-01-051-9/+10
| | | | | | | | | | | | | | | | | | Further generic-ify the `after` parameter on the `reaction_users` method of the following structs: - `ChannelId` - `Group` - `GuildChannel` - `Message` - `Channel` - `GuildChannel` Do this by changing the `U` trait bound from `Into<UserId>` to `Into<Option<UserId>>`. This resolves problems determining types when passing `None` as the argument, as reported in #247.
* Move `VecMap` to `utils`acdenisSK2018-01-021-2/+2
| | | | This also fixes no-builder compilation
* Implement or derive Serialize on all modelsZeyla Hellyer2018-01-011-1/+1
|
* Improve performance of builders even furtheracdenisSK2017-12-271-4/+4
| | | | | | By negating hashing altogether. The increase is around 1000-ish nanoseconds saved.
* Break up the model moduleZeyla Hellyer2017-12-161-19/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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}; ```
* Re-order use statements alphabeticallyZeyla Hellyer2017-11-111-4/+4
|
* Merge v0.4.3acdenisSK2017-11-041-1/+1
|\
| * Rename `Guild::permissions_for`->`permissions_in`Zeyla Hellyer2017-10-301-1/+1
| | | | | | | | | | | | Rename `Guild::permissions_for` to `Guild::permissions_in`, deprecating `Guild::permissions_for` which is only an inline method to `permissions_in`.
* | Make the Client return a ResultZeyla Hellyer2017-11-031-2/+6
| | | | | | | | | | | | | | | | The client now returns a Result in preparation of a future commit. Upgrade path: Handle the case of an error via pattern matching, or unwrap the Result.
* | Merge v0.4.2acdenisSK2017-10-241-1/+1
|\|
| * defer to `delete_message` if there's just one message to deleteacdenisSK2017-10-161-1/+1
| |
| * Replace slice parametres by IntoIterator (#177)François Triquet2017-10-051-1/+1
| | | | | | Fixes #174
| * Replace Vec parameters by IntoIterator (#176)François Triquet2017-10-041-1/+1
| |
| * `to_owned` -> `to_string`acdenisSK2017-10-011-4/+4
| |
* | Remove `on_` prefix to EventHandler tymethodsZeyla Hellyer2017-10-221-2/+2
| | | | | | | | | | It was voted that the `on_` prefix is unnecessary, so these have been dropped.
* | Slightly improve performance of buildersZeyla Hellyer2017-10-181-13/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Switch to parking_lot::{Mutex, RwLock}Zeyla Hellyer2017-10-101-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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); ```
* | Replace slice parametres by IntoIterator (#177)François Triquet2017-10-091-1/+1
| | | | | | Fixes #174
* | Replace Vec parameters by IntoIterator (#176)François Triquet2017-10-091-1/+1
| |
* | `to_owned` -> `to_string`acdenisSK2017-10-091-4/+4
|/
* Update bitflags, other dependenciesZeyla Hellyer2017-09-211-12/+12
| | | | | | | | | | | | | | | | | | | | | | | Bitflags changed its macro codegen from creating constants to associated constants on structs. Upgrade path: Update code from: ```rust use serenity::model::permissions::{ADD_REACTIONS, MANAGE_MESSAGES}; foo(vec![ADD_REACTIONS, MANAGE_MESSAGES]); ``` to: ```rust use serenity::model::Permissions; foo(vec![Permissions::ADD_REACTIONS, Permissions::MANAGE_MESSAGES]); ```
* Apply rustfmtZeyla Hellyer2017-09-181-10/+3
|
* Fix compiles of a variety of feature combinationsZeyla Hellyer2017-09-181-2/+2
| | | | | This fixes compilation errors and warnings when compiling a mixture of non-default feature targets.
* Apply rustfmt + fix testsZeyla Hellyer2017-09-091-3/+3
|
* `parent_id` -> `category_id`acdenisSK2017-09-091-1/+2
|
* Implement categoriesacdenisSK2017-09-091-0/+2
|
* Add ability to play DCA and Opus files. (#148)Maiddog2017-08-271-4/+11
|
* Revamp `RwLock` usage in the libacdenisSK2017-08-241-12/+4
| | | | Also not quite sure if they goofed rustfmt or something, but its changes it did were a bit bizarre.
* Apply rustfmtZeyla Hellyer2017-08-181-3/+10
|
* Use `#[serde(default)]` on `nsfw` insteadacdenisSK2017-08-151-3/+1
|
* Change the config a bit, and a few nitpicksacdenisSK2017-07-271-23/+15
|
* rustfmtacdenisSK2017-07-271-69/+71
|
* Fix the tests (#129)Bond-0092017-07-211-1/+1
|
* Implement the new way of knowing some channels as "nsfw"acdenisSK2017-07-181-1/+14
|
* Fix GuildChannel::permissions_for doctestsZeyla Hellyer2017-07-151-5/+5
|
* Fix more doc testsacdenisSK2017-07-141-1/+1
|
* Add `ChannelId,PrivateChannel,GuildChannel::name` functionsacdenisSK2017-07-141-0/+5
|
* Improve `BanOptions` to be more efficient and remove uneccessary `Read` importsacdenisSK2017-07-131-2/+0
|
* Remove the deprecated functionsacdenisSK2017-07-111-31/+0
| | | | It's already been enough time for people to migrate
* Fix doc testsacdenisSK2017-07-021-36/+43
|
* Docs fixesmei2017-06-271-6/+6
|
* Deprecate Client::login, add Client::newZeyla Hellyer2017-06-061-2/+2
|
* Use chrono for struct timestamp fieldsZeyla Hellyer2017-06-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Chrono is easier to use than timestamped strings, so they should be automatically deserialized and available for the user, instead of having the user deserialize the strings themselves. These fields have been changed to use a type of `DateTime<FixedOffset>`: - `ChannelPinsUpdateEvent.last_pin_timestamp` - `Group.last_pin_timestamp` - `Guild.joined_at` - `GuildChannel.last_pin_timestamp` - `Invite.created_at` - `Member.joined_at` - `Message.edited_timestamp - `Message.timestamp` - `MessageUpdateEvent.edited_timestamp` - `MessageUpdateEvent.timestamp` - `PrivateChannel.last_pin_timestamp` `Member.joined_at` is now also an `Option`. Previously, if a Guild Member Update was received for a member not in the cache, a new Member would be instantiated with a default String value. This is incorrect behaviour, and has now been replaced with being set to `None` in that case. Id methods' `created_at()` method now return a `chrono::NaiveDateTime` instead of a `time::Timespec`, and `User::created_at` has been updated to reflect that. Additionally, drop `time` as a direct dependency and use chrono for internals.
* Fix links to ChannelId::send_filesZeyla Hellyer2017-06-041-2/+2
| | | | | | Helper methods such as `GuildChannel::send_files` linked to the documentation for `ChannelId::send_file`, when they should be linking to `ChannelId::send_files`.