aboutsummaryrefslogtreecommitdiff
path: root/src/client
Commit message (Collapse)AuthorAgeFilesLines
...
* Tiny import re-orderAustin Hellyer2016-11-261-2/+1
|
* More widely support no-cache method compilesAustin Hellyer2016-11-252-0/+14
| | | | | | | Conditional compiles with the 'methods' feature enabled - but the 'cache' feature disabled - were supported, but methods would call an empty function to check if the current user has permissions. Instead, put these function calls behind macros which check for feature cfgs.
* Move events into their own moduleAustin Hellyer2016-11-255-76/+93
| | | | | | | | | | | | | | | | | | | | The events were cluttering the `model` module, and so are now moved into their own `model::event` module. As users should not usually have to work with events all that much - only currently in some rarely used event handlers - this change should not be much more effort to import from. i.e.: ```rs use serenity::model::event::ChannelPinsAckEvent; ``` vs. the now-old: ```rs use serenity::model::ChannelPinsAckEvent; ```
* Rename PublicChannel to GuildChannelAustin Hellyer2016-11-252-22/+22
|
* Rename the `http` module to `rest`Austin Hellyer2016-11-255-111/+111
|
* Rename guild structs to Guild and PartialGuildAustin Hellyer2016-11-245-34/+48
|
* Ignore WebSocketError::NoDataAvailableAustin Hellyer2016-11-231-0/+2
| | | | | | | This may turn out to be a bad idea, but this causes a reconnect, as part of the catch-all `rust-websocket` crate error handling. Since this variant in particular doesn't seem directly harmful to ignore, it may be better to just throw away than to reconnect.
* Update doctest to use new CacheAustin Hellyer2016-11-221-1/+1
|
* Change the CACHE to be an RwLockAustin Hellyer2016-11-223-14/+14
| | | | | | | | | | | | | | | | | | 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-225-122/+122
|
* Don't unnecessarily borrow some if-letsAustin Hellyer2016-11-213-7/+7
|
* Re-organize the client moduleAustin Hellyer2016-11-219-560/+606
| | | | | | | | | | | | | | | | | | 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.
* Don't block entirely on HTTP requestsAustin Hellyer2016-11-211-8/+5
| | | | | | While this has the potential to hit 429s in very minimal periods of time, this will allow multiple concurrent HTTP requests, whereas before they were forced to be sync.
* Make Context::channel_id publicAustin Hellyer2016-11-211-1/+5
|
* No-run on context doc exampleAustin Hellyer2016-11-201-1/+1
|
* Add methods for setting individual presence dataAustin Hellyer2016-11-202-6/+103
|
* 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-192-7/+7
| | | | | | | | | | 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 type errors for non-framework buildsAustin Hellyer2016-11-192-5/+13
|
* Nonblocking connectionAustin Hellyer2016-11-193-81/+70
| | | | | | | | | | | The connection is now non-blocking, allowing user event handlers to immediately unlock it themselves (assuming they haven't unlocked it elsewhere), rather than waiting on the library to receive an event. This is done by decoupling the receiver away from the connection, which is not necessarily "directly" associated with the connection. This needs a _lot_ of code cleanup later.
* Fix cond. compile across multiple feature targetsAustin Hellyer2016-11-194-91/+180
| | | | | | | | 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
|
* Register friend suggestion eventsAustin Hellyer2016-11-183-0/+42
|
* A bit of docsAustin Hellyer2016-11-185-117/+535
|
* Feature macros should use else as block separatorAustin Hellyer2016-11-182-4/+4
|
* Ratelimiting: don't attempt to RL for NoneAustin Hellyer2016-11-181-14/+18
| | | | | | Some routes, mostly user-specific ones, do not have ratelimit headers. So when specifying the `Route::None` variant, do not attempt to treat it as its own bucket, and instead ignore ratelimiting for it.
* Add DELETE/PUT guild member roleAustin Hellyer2016-11-162-0/+37
| | | | | | | | | | Adds support for `DELETE /guilds/:guild_id/members/:user_id/roles/:role_id` and `PUT /guilds/:guild_id/members/:user_id/roles/:role_id`, which are routes to add or remove individual roles to a guild member. The `Member::add_role` and `Member::remove_role` methods will edit in-place.
* 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-155-301/+600
| | | | | | | | | | | | | | | 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-152-15/+16
| | | | | | | | | | | | | | | | 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)); ```
* State: on update, return old instancesAustin Hellyer2016-11-153-78/+81
| | | | | | | | | When updating the State, return the old instance of removed/updated fields where possible, so that they can be used to send to event handlers as a "this is what it used to look like, this is what it looks like now" type of thing. Very descriptive, I know.
* Allow current user to nickname themselvesAustin Hellyer2016-11-143-0/+34
| | | | | | | | | | | | | | | | | | Add support for the `PATCH /guilds/:guild_id/members/@me/nick` endpoint, which allows the current user to edit their own nickname. A user can only nickname themselves if they have the `Change Nickname` permission. This adds 4 methods: - `serenity::client::http::edit_nickname`; - `serenity::client::Context::edit_nickname`; - `serenity::model::Guild::edit_nickname`; - `serenity::model::LiveGuild::edit_nickname`. `LiveGuild`'s implementation checks for whether the current user has permission to change their own nickname.
* Add voice connection supportAustin Hellyer2016-11-145-93/+121
|
* Add internal moduleAustin Hellyer2016-11-146-6/+6
| | | | | Create a general `internal` module, and move `prelude_internal` to `internal::prelude`.
* Move the builders to the utilsAustin Hellyer2016-11-131-1/+1
| | | | | | | | | The builders aren't a large enough portion of the library to deserve their own root-level module, so move them to the `utils` module. Additionally, split them into separate files, as the library will be receiving more builders and the single-file pattern was getting rather large.
* Add a check for message content lengthAustin Hellyer2016-11-122-1/+44
| | | | | | | | | | Before sending a request to Discord, ensure that a message's content on non-HTTP functions and methods meets the required length. If it exceeds the limit, then return a `Error::Client(ClientError::MessageTooLong(u64))`, containing the number of unicode code points exceeding the limit. Note that directly using the HTTP methods does not impose this limit.
* Add delete_message_reactions + register eventAustin Hellyer2016-11-115-0/+52
| | | | | | | | | Add the `delete_message_reactions` endpoint (`DELETE /channels/{}/messages/{}/reactions`) and implement a method on the `Message` struct for easy access, `delete_reactions`. Register the `MESSAGE_REACTION_REMOVE_ALL` event and add an event handler.
* Add a clippy configAustin Hellyer2016-11-101-5/+5
|
* Fix leave_guild endpointAustin Hellyer2016-11-101-2/+2
|
* Fix some clippy lintsAustin Hellyer2016-11-101-2/+0
|
* Implementing missing HTTP methodsAustin Hellyer2016-11-102-5/+36
| | | | | | | | | The missing HTTP methods are: - get_guild_integrations: `GET /guilds/:guild_id/integrations - get_guild_regions: `GET /guilds/:guild_id/regions` - get_user_connections: `GET /users/@me/connections` - get_user_dm_channels: `GET /users/@me/channels`
* Fix ratelimit bucket for start_integration_syncAustin Hellyer2016-11-101-1/+1
|
* slice_patterns is not stableAustin Hellyer2016-11-101-5/+5
|
* Properly shutdown on connection DropAustin Hellyer2016-11-101-0/+24
|
* Correctly shutdown the connectionAustin Hellyer2016-11-101-5/+13
| | | | Rather than completely dropping the connection, send a close code prior.
* Map op codes via a macroAustin Hellyer2016-11-091-0/+1
|