aboutsummaryrefslogtreecommitdiff
path: root/src/client/context.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* Make a single POST on guild role createAustin Hellyer2017-01-181-13/+1
| | | | | The endpoint to create a role no longer returns an empty role which must be PATCHed, and can be completed in the initial request.
* Clarify that messages can't be older than 2 weeks.Illia2017-01-141-0/+2
|
* Simplify a small bit of ContextAustin Hellyer2017-01-041-21/+14
|
* Simplify Context::get_reaction_usersAustin Hellyer2017-01-041-5/+1
|
* Fix Context::get_reaction_users docsAustin Hellyer2017-01-041-6/+0
|
* Add Context::get_userAustin Hellyer2017-01-041-0/+22
|
* Implement context message queueingTaavi2017-01-011-1/+38
| | | Also the dreaded `ctx <<= "something"` which is actually a mistake.
* Add guild and channel searchAustin Hellyer2016-12-291-1/+82
|
* Use conditional blocks over macrosAustin Hellyer2016-12-291-6/+9
|
* Implement command groups and bucketsIllia2016-12-131-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implement command groups * change to ref mut * Implement framework API. * Remove commands field * Make it all work * Make example use command groups * Requested changes * Implement adding buckets * Add ratelimit check function * Finish everything * Fix voice example * Actually fix it * Fix doc tests * Switch to result * Savage examples * Fix docs * Fixes * Accidental push * 👀 * Fix an example * fix some example * Small cleanup * Abstract ratelimit bucket logic
* More config for CreateCommand, add various methodsIllia2016-12-101-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+1
| | | | Additionally, flag imports behind feature flags to avoid unused imports.
* Change all try's into ?sacdenisSK2016-12-071-8/+8
| | | This breaks compatibility with < 1.13, but we didn't support that anyway.
* Add a ShareMap across contextsAustin Hellyer2016-12-051-0/+8
| | | | | | | | The context now exposes, through the Client, a `data` field, which can be accessed safely across contexts. This allows for a custom "shared state" without the need for (ab)using lazy-static.rs. Refer to example 06 for an example on how to use shared data.
* Add more Context docs+permission requirementsAustin Hellyer2016-12-041-26/+170
| | | | | Add more documentation to most of the Context methods, also clarifying which permission/s are required for each method.
* Add documentation for modelsIllia2016-12-041-0/+5
|
* Fix signature of Context::move_memberAustin Hellyer2016-12-031-2/+2
|
* Make rest::edit_profile set new tokenAustin Hellyer2016-12-031-2/+2
| | | | | | | | | | | If a user account changes their profile settings, they'll receive a new token; update the locally stored token for REST requests with this token. Additionally, the `Context::edit_profile` does not need mutability over self. Fixes #25.
* Paginate rest::get_guilds and add helper methodsAustin Hellyer2016-12-021-4/+24
| | | | | | | | | | | | | | | | | | | | Paginate the rest::get_guilds endpoint, which can be used to retrieve the guilds after-or-before a certain guild's Id, with a limit of results to return (100 is the max). Example usage: ```rs use serenity::client::rest::GuildPagination; let target = GuildPagination::After(GuildId(81384788765712384)); let guilds = context.get_guilds(target, 50); ``` Additionally, add a method of `CurrentUser::guilds()`, to retrieve the current user's guilds. A limit of 100 is set, as (most) users can not be in more than 100 guilds.
* Clarify some docsAustin Hellyer2016-11-301-43/+107
|
* Add remaining REST routesAustin Hellyer2016-11-301-0/+15
| | | | | | The status routes were missing from the HTTP module (now the REST module) rewrite, as well as the `GET /guilds/:id/members` route. In addition, remove an unnecessary counter to the global ratelimit mutex.
* Clean up the codebaseAustin Hellyer2016-11-291-23/+25
|
* Fix doctestsAustin Hellyer2016-11-281-1/+1
|
* Improve docs and add new message builder methodsIllia K2016-11-281-22/+19
| | | | | Add documentation for some missing methods - such as Game methods - and add more methods to the Message Builder.
* Add Context, REST, and model documentationfwrs2016-11-271-0/+130
| | | | | Add documentation for Context methods, as well as brief documentation for REST functions and model definitions.
* Make send_file use the CreateMessage builderAustin Hellyer2016-11-271-11/+21
|
* Voice example no longer requires 'extras'Austin Hellyer2016-11-261-6/+2
|
* Make Cache::get_channel return a referenceAustin Hellyer2016-11-261-1/+1
| | | | | | | 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-10/+10
|
* Rename the `http` module to `rest`Austin Hellyer2016-11-251-72/+72
|
* Rename guild structs to Guild and PartialGuildAustin Hellyer2016-11-241-11/+20
|
* Update doctest to use new CacheAustin Hellyer2016-11-221-1/+1
|
* 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-28/+28
|
* Don't unnecessarily borrow some if-letsAustin Hellyer2016-11-211-2/+2
|
* Re-organize the client moduleAustin Hellyer2016-11-211-17/+17
| | | | | | | | | | | | | | | | | | Re-organize the client module, creating a `gateway` submodule, and splitting the connection into separate files in it. The connection was a conglomeration of a number of purposes, most of which are actually used elsewhere in the library and/or exposed to the user. Thus, it makes sense to separate each item in a gateway-specific module. By splitting the client module further, this is a re-organization for preliminary RPC support WRT the Client. Additionally, rename the Connection struct to a Shard. The Connection itself was not the actual connection, and was a higher-level interface to the real connection logic. A Shard is a more accurate representation of what it actually is.
* Make Context::channel_id publicAustin Hellyer2016-11-211-1/+5
|
* Add methods for setting individual presence dataAustin Hellyer2016-11-201-0/+32
|
* Fix context doctestsAustin Hellyer2016-11-201-4/+4
|
* Rework contextual presence methodsAustin Hellyer2016-11-191-9/+72
| | | | | | | | | Rework the methods to accept strings and games directly, rather than Optional values. Instead, use the new `reset_presence` to set a clean status, or `set_presence` for more fine-grained control. In addition, `Game::playing` and `Game::streaming` now accept `&str`s rather than Strings.
* Rename state methods from find_ to get_Austin Hellyer2016-11-191-5/+5
| | | | | | | | | | 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.
* Fix cond. compile across multiple feature targetsAustin Hellyer2016-11-191-8/+14
| | | | | | | | Fixes conditional compilation across multiple combinations of feature targets, where it was assumed a second feature would be enabled by something that requires a feature to be enabled. This also fixes an EOF compilation error on no-feature builds.
* Don't send embed on message edits if emptyAustin Hellyer2016-11-191-5/+9
|
* Add Context::set_game_nameAustin Hellyer2016-11-181-0/+18
|
* A bit of docsAustin Hellyer2016-11-181-22/+206
|
* Accepting invites only works for user accountsAustin Hellyer2016-11-161-0/+16
| | | | | They do not work for bot users. So return a `ClientError::InvalidOperationAsBot` if someone tries to.
* Add message edit/edit_message rich embedsAustin Hellyer2016-11-151-2/+10
|
* Add send_message rich embedsAustin Hellyer2016-11-151-6/+91
|
* Add state/framework/etc. conditional compile flagsAustin Hellyer2016-11-151-10/+17
| | | | | | | | | | | | | | | 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 a message builder for Context::send_messageAustin Hellyer2016-11-151-14/+15
| | | | | | | | | | | | | | | | Add a message builder to `send_message`. Often only one field - i.e. `content` - needs to be specified, and the rest can be ignored. This is a preliminary patch to add rich embed support to messages. This message builder is used via: ```rust // assuming in a context with a `channel_id` bound context.send_message(channel_id, |m| m .content("TTS ping!") .tts(true)); ```