aboutsummaryrefslogtreecommitdiff
path: root/src/model/channel/message.rs
Commit message (Collapse)AuthorAgeFilesLines
* Add Nick Methods for `Message` and `UserId` (#432)Lakelezz2018-11-111-0/+9
|
* Remove cache requirement on Message::is_privateZeyla Hellyer2018-09-141-5/+1
| | | | | This can instead check the `guild_id` structfield, so the cache is no longer required.
* Message: avoid perm checks in non-guild channelsZeyla Hellyer2018-09-141-12/+20
|
* Use `to_`- and `as_`-methods instead of `get` and `find` on Id newtypesLakelezz2018-08-121-2/+2
|
* Fix all the dead links in the docsErk-2018-08-091-25/+26
|
* Add `impl AsRef<MessageId> for Message` (#355)Adelyn2018-07-251-0/+6
|
* Deprecate Message::guild_id()Zeyla Hellyer2018-07-091-14/+11
| | | | | Instead, using the structfield is preferred, since that comes from gateway events directly now anyway.
* Monomorphize all functionsZeyla Hellyer2018-07-041-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* feature: add guild_id to Message, per g250k changesChristopher F2018-06-171-0/+5
| | | | | | this allows stateless bots to drop the need for a channel->guild mapping (cherry picked from commit 74bb8fa5a3b4b5fd43559866b4627bf09484f6ae)
* Add methods to check whether `Message` is mentioning `User` (#323)Lakelezz2018-05-291-0/+15
|
* Add `Message::member` structfieldZeyla Hellyer2018-05-211-0/+3
| | | | | Adds the `Message::member` structfield, which contains a partial amount of member data (deaf and mute status, role IDs, and joined_at).
* Change the way ids and some enums are made (#295)Leah2018-03-231-17/+29
| | | | | This makes them easier to be found by tools like rls. Also update struct inits to use the shorthand version for `x: x`.
* Pad user discriminators in content_safe to 4 digitsMegumi Sonoda2018-02-231-1/+1
| | | | This brings the function in line with the 'tag' function for User models, and with the official Discord app experience and other libraries.
* Add `Message::member`Zeyla Hellyer2018-01-271-0/+13
| | | | | | | | | Add a `member` function on `model::channel::Message` to retrieve a clone of the author's Member instance in the channel's guild. If the message was not sent in a guild, the guild could not be found in the cache, or the member instance could not be found in the cache, then `None` is returned.
* Add an `EditMessage` builderZeyla Hellyer2018-01-181-10/+6
| | | | | | 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-8/+8
| | | | | | | | | | | | | | | | | | 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.
* Implement or derive Serialize on all modelsZeyla Hellyer2018-01-011-2/+2
|
* Add missing 'num' implementations on modelsZeyla Hellyer2017-12-271-0/+17
| | | | | | | Add missing 'num' implementations from the following models: - `channel::{ChannelType, MessageType}` - `gateway::GameType`
* Improve performance of builders even furtheracdenisSK2017-12-271-1/+1
| | | | | | By negating hashing altogether. The increase is around 1000-ish nanoseconds saved.
* Break up the model moduleZeyla Hellyer2017-12-161-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 doc-testsacdenisSK2017-11-161-2/+1
|
* Re-order use statements alphabeticallyZeyla Hellyer2017-11-111-9/+5
|
* Make the Client return a ResultZeyla Hellyer2017-11-031-1/+1
| | | | | | | | 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.
* Slightly improve performance of buildersZeyla Hellyer2017-10-181-1/+3
| | | | | | | | | | | | | | | 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.
* Update to account for changes made in 0.4.1acdenisSK2017-10-141-2/+2
|\
| * Fix clippy lintsZeyla Hellyer2017-10-111-2/+2
| |
| * Revert "Use the de-generification trick."acdenisSK2017-10-031-5/+1
| | | | | | | | Makes the compiliation time just a bit worse
| * Use the de-generification trick.acdenisSK2017-10-021-1/+5
| | | | | | | | Fixes #168
| * `to_owned` -> `to_string`acdenisSK2017-10-011-1/+1
| |
* | Switch to parking_lot::{Mutex, RwLock}Zeyla Hellyer2017-10-101-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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); ```
* | Revert "Use the de-generification trick."acdenisSK2017-10-091-5/+1
| | | | | | | | Makes the compiliation time just a bit worse
* | Use the de-generification trick.acdenisSK2017-10-091-1/+5
| | | | | | | | Fixes #168
* | `to_owned` -> `to_string`acdenisSK2017-10-091-1/+1
|/
* Update bitflags, other dependenciesZeyla Hellyer2017-09-211-6/+6
| | | | | | | | | | | | | | | | | | | | | | | 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-16/+13
|
* 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-0/+1
|
* Add ability to play DCA and Opus files. (#148)Maiddog2017-08-271-13/+16
|
* Revamp `RwLock` usage in the libacdenisSK2017-08-241-16/+13
| | | | Also not quite sure if they goofed rustfmt or something, but its changes it did were a bit bizarre.
* Fix tests (#145)Maiddog2017-08-221-0/+1
|
* Move builtin framework impl to its own moduleZeyla Hellyer2017-08-191-2/+2
| | | | | | | | | | | | | | | | | The framework is now moved in its entirity to the `framework` module, with the `Framework` trait currently on its own and the builtin implementation provided. The builtin implementation has been renamed to "Standard". Upgrade path: Rename the `BuiltinFramework` import to `StandardFramework`. Instead of importing builtin framework items from `serenity::framework`, import them from `serenity::framework::standard`. This is the beginning to #60. The root `framework` module (non-standard implementation) will be built more by the time it's closed.
* Apply rustfmtZeyla Hellyer2017-08-181-13/+16
|
* Change the config a bit, and a few nitpicksacdenisSK2017-07-271-7/+6
|
* rustfmtacdenisSK2017-07-271-51/+53
|
* Fix is_own codeZeyla Hellyer2017-07-251-1/+1
| | | | | The current user ID is located on the `user` structfield in the cache, and is not directly on the cache.
* Actually, rename it to "is_own" insteadacdenisSK2017-07-261-1/+1
|
* Add a util function for checking if a message was sent by the bot or someone ↵acdenisSK2017-07-261-0/+6
| | | | else
* Fix #130acdenisSK2017-07-221-1/+2
| | | | Removed action support from the builtin one as well, due to it adding some uneccassery complexity and it being only asked upon by one user
* Remove the deprecated functionsacdenisSK2017-07-111-10/+0
| | | | It's already been enough time for people to migrate
* Fix doc testsacdenisSK2017-07-021-3/+5
|