aboutsummaryrefslogtreecommitdiff
path: root/src/model/utils.rs
Commit message (Collapse)AuthorAgeFilesLines
* Code style cleanupAustin Hellyer2017-01-081-5/+8
|
* Add guild and channel searchAustin Hellyer2016-12-291-0/+30
|
* Accept u64 shard countsAustin Hellyer2016-12-261-3/+3
|
* More config for CreateCommand, add various methodsIllia2016-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 no-cache+method conditional compilesAustin Hellyer2016-12-101-3/+3
| | | | Additionally, flag imports behind feature flags to avoid unused imports.
* Change all try's into ?sacdenisSK2016-12-071-19/+19
| | | This breaks compatibility with < 1.13, but we didn't support that anyway.
* Clean up the codebaseAustin Hellyer2016-11-291-20/+1
|
* Optimize for cached, non-method compilesAustin Hellyer2016-11-281-7/+0
|
* Make Cache::get_channel return a referenceAustin Hellyer2016-11-261-2/+4
| | | | | | | 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-2/+2
|
* Allow compiling with only either cache or methodsAustin Hellyer2016-11-241-0/+7
| | | | | | | | | 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.
* Change the CACHE to be an RwLockAustin Hellyer2016-11-221-1/+1
| | | | | | | | | | | | | | | | | | 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-7/+7
|
* Rename state methods from find_ to get_Austin Hellyer2016-11-191-2/+2
| | | | | | | | | | 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 state/framework/etc. conditional compile flagsAustin Hellyer2016-11-151-2/+6
| | | | | | | | | | | | | | | 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 voice connection supportAustin Hellyer2016-11-141-1/+5
|
* Add internal moduleAustin Hellyer2016-11-141-1/+1
| | | | | Create a general `internal` module, and move `prelude_internal` to `internal::prelude`.
* Fix some clippy lintsAustin Hellyer2016-11-101-12/+0
|
* 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.
* Add message reactionsAustin Hellyer2016-11-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | Add message reaction structs and an enum to differentiate between the two types of reactions, as well as event decoding and event handlers with dispatches. The following is, more or less, what is added: - `reactions` field to the `Message` struct; - `MessageReaction` struct, which is a consolidated form of reaction, containing the type of reaction, the number of them, and whether the current user has performed that type of reaction; - `Reaction`, a struct containing the information about a reaction - `ReactionType`, an enum to differentiate between the two types of reactions: `Custom` (a guild's custom emoji) and `Unicode` (twemoji); - Decoding for `MESSAGE_REACTION_ADD` and `MESSAGE_REACTION_REMOVE`; - Permission flag `ADD_REACTIONS`; - `Message::react` method; - Three `http` payload senders: `create_reaction`, `delete_reaction`, and `get_reaction_users`; - Three `Context` methods of equal names to the above.
* Initial commitAustin Hellyer2016-10-181-0/+313