aboutsummaryrefslogtreecommitdiff
path: root/src/model/id.rs
Commit message (Collapse)AuthorAgeFilesLines
* Use `to_`- and `as_`-methods instead of `get` and `find` on Id newtypesLakelezz2018-08-121-0/+12
|
* Fix all the dead links in the docsErk-2018-08-091-1/+1
|
* impl Form<&$ID> for $IDZeyla Hellyer2018-07-081-0/+6
| | | | Implements `From<&Id>` for all `Id` types, e.g. `From<&RoleId> for RoleId`.
* Change the way ids and some enums are made (#295)Leah2018-03-231-16/+51
| | | | | This makes them easier to be found by tools like rls. Also update struct inits to use the shorthand version for `x: x`.
* Break up the model moduleZeyla Hellyer2017-12-161-0/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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}; ```
* Switch to a mostly-fully OOP approachAustin Hellyer2017-01-231-238/+0
| | | | | | The context is now strictly in relation to the context of the current channel related to the event, if any. See Context::say for a list of events that the context can be used for.
* First round of deleting useless methodsAustin Hellyer2017-01-151-8/+0
|
* Alphabetize model method namesAustin Hellyer2017-01-081-0/+1
|
* Use conditional blocks over macrosAustin Hellyer2016-12-291-2/+3
|
* Fix a typo in UserId::find docsAustin Hellyer2016-12-181-1/+1
|
* Make Id displays format u64 instead of a mentionAustin Hellyer2016-12-171-3/+3
| | | | | | Instead of mentioning the channel, role, or user on an Id display format, format its inner u64 instead. Instead, use `Id::mention()` to accomplish the equivilant.
* More config for CreateCommand, add various methodsIllia2016-12-101-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Adds multiple configurations to the command builder, and adds methods to various structs. Context::get_current_user is a shortcut to retrieve the current user from the cache. Message::get_member retrieves the member object of the message, if sent in a guild. Message::is_private checks if the message was sent in a Group or PrivateChannel. User::member retrieves the user's member object in a guild by Id; Adds 6 configurations to the command builder: - dm_only: whether the command can only be used in direct messages; - guild_only: whether the command can only be used in guilds; - help_available: whether the command should be displayed in the help list; - max_args: specify the maximum number of arguments a command must be given; - min_args: specify the minimum number of arguments a command must be given; - required_permissions: the permissions a member must have to be able to use the command;
* Fix some clippy lintsAustin Hellyer2016-12-091-1/+1
|
* Allow mentionable structs to be used as command argumentsIllia2016-12-071-0/+8
| | | | | Add EmojiIdentifier, allow User, UserId, Role, RoleId, EmojiIdentifier, Channel and ChannelId to be used as arguments for commands and add more parsing functions to utils
* Improve Mentions, fix MessageBuilderIllia2016-12-061-40/+28
| | | | | Remove the obsolete Mention struct as well as related methods, improve the way mentioning works, fix the message builder, add a test for all this.
* Improve docs and add new message builder methodsIllia K2016-11-281-0/+14
| | | | | Add documentation for some missing methods - such as Game methods - and add more methods to the Message Builder.
* Make Cache::get_channel return a referenceAustin Hellyer2016-11-261-2/+2
| | | | | | | Additionally, allow it to search the groups' and private channels' maps in the cache. As these are usually O(1) operations, it's cheap to allow, in comparison to the current unoptimized method of getting a guild's channel.
* Rename PublicChannel to GuildChannelAustin Hellyer2016-11-251-3/+3
|
* Rename the `http` module to `rest`Austin Hellyer2016-11-251-6/+6
|
* Allow compiling with only either cache or methodsAustin Hellyer2016-11-241-7/+11
| | | | | | | | | Some of the methods relied on the cache being present. Now, these methods only conditionally require the cache to be compiled and present. The cache was mainly used for checking if the current user had permission to perform operations.
* Rename guild structs to Guild and PartialGuildAustin Hellyer2016-11-241-6/+6
|
* Change the CACHE to be an RwLockAustin Hellyer2016-11-221-4/+4
| | | | | | | | | | | | | | | | | | The global Cache used to be an Arc<Mutex>, however the issue is that it could only be opened for reading or writing once at a time. With an RwLock, multiple readers can access the Cache at once, while only one Writer may at once. This will allow users to be able to have multiple Readers open at once, which should ease some of the pains with working with the Cache. Upgrade path: Modify all uses of the CACHE from: `CACHE.lock().unwrap()` to `CACHE.read().unwrap()` if reading from the Cache (most use cases), or `CACHE.write().unwrap()` to write to it.
* Rename the State to CacheAustin Hellyer2016-11-221-9/+9
|
* Rename state methods from find_ to get_Austin Hellyer2016-11-191-5/+4
| | | | | | | | | | For consistency with the rest of the library, rename the methods prefixed with `find_` to `get_`. The past logic was that items are "found", as they may or may not exist. With get, the expectation is that it is _always_ there, i.e. over REST. However, this is inconsistent, and "get"ting over REST can fail for other reasons.
* Add GuildId::to_channelAustin Hellyer2016-11-181-0/+8
|
* Add state/framework/etc. conditional compile flagsAustin Hellyer2016-11-151-0/+11
| | | | | | | | | | | | | | | This adds conditional compilation for the following features, in addition to the voice conditional compilation flag: - extras (message builder) - framework - methods - state These 4 are enabled _by default_, while the `voice` feature flag is disabled. Disabling the state will allow incredibly low-memory bots.
* Add internal moduleAustin Hellyer2016-11-141-1/+1
| | | | | Create a general `internal` module, and move `prelude_internal` to `internal::prelude`.
* Add webhook supportAustin Hellyer2016-11-071-0/+29
|
* Add a prelude for userlandAustin Hellyer2016-11-051-1/+1
| | | | | | | Users can now import all of a prelude via `use serenity::prelude::*;`, which should provide some helpful stuff. As such, the internal prelude is now named `serenity::prelude_internal`, and all internal uses have been adjusted.
* Convert all doc anchors to named anchorsAustin Hellyer2016-11-051-6/+13
| | | | | | | | | | | | | | | | | | | | Convert all of the non-named anchors in docs to named anchors. Example: ```md Kicks a [`Member`](../model/struct.Member.html) from the specified [`Guild`](../model/struct.Guild.html) if they are in it. ``` is now written as: ```md Kicks a [`Member`] from the specified [`Guild`] if they are in it. [`Guild`]: ../model/struct.Guild.html [`Member`]: ../model/struct.Member.html ```
* Initial commitAustin Hellyer2016-10-181-0/+176