aboutsummaryrefslogtreecommitdiff
path: root/src/client
Commit message (Collapse)AuthorAgeFilesLines
* Change signature of EventHandler::message_update and the dispatch call to ↵fix_message_updateMishio5952018-09-052-4/+2
| | | | account for situations where the new message is not cached
* Old message on update (#368)Adelyn2018-08-262-7/+21
|
* Fix all the dead links in the docsErk-2018-08-096-26/+25
|
* Fix erroneous deadlock detected messages. (#363)Lymia Aluysia2018-08-081-10/+10
|
* Fix compilation + tests on certain feature combosZeyla Hellyer2018-08-072-0/+11
| | | | | | | | On certain feature combinations, compilation and tests would not function correctly. This commit goes through a number of feature combinations and gates some tests behind the required features and fixes other compilation errors.
* Fix potential dispatch cache deadlocking + log itZeyla Hellyer2018-08-021-1/+12
| | | | | | Fix the dispatch functionality potentially deadlocking when a deadlock has occurred elsewhere (or a read/write lock is forever held elsewhere), and log when it happens, WARNing the user that a possible deadlock has happened.
* Add missing `mut`acdenisSK2018-08-021-1/+1
|
* Don't delay Ready with cache enabledZeyla Hellyer2018-08-011-46/+5
| | | | | | | | | | | When the cache is enabled, don't delay the Ready until all guilds have been received. This never really worked in the first place and duplicates the "cached" logic that fires when all guilds have been received. This presumably fixes the "silent death" bug, as this appears to stall the thread on certain conditions.
* De-cringe a commentacdenisSK2018-08-011-3/+3
|
* Add From impls for Game, generify Game paramsZeyla Hellyer2018-08-012-12/+24
| | | | | Add more `impl From<T> for Game` implementations, and make `Into<Game>` trait bounds for all function parameters accepting a Game.
* Deprecate Context::edit_profileZeyla Hellyer2018-07-311-0/+1
| | | | This method won't exist in v0.6.x.
* Fix some clippy lintsZeyla Hellyer2018-07-152-4/+4
| | | | | Some lints were not resolved due to causing API changes. Most lints in the framework were left unfixed.
* Fix doc links with no anchorZeyla Hellyer2018-07-112-3/+4
|
* Add a message cache API (#345)zeyla2018-07-091-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds an API for message caching. By default this caches 0 messages per channel. This can be customized when instantiating: ```rust use serenity::cache::{Cache, Settings}; let mut settings = Settings::new(); // Cache 10 messages per channel. settings.max_messages(10); let cache = Cache::new_with_settings(settings); ``` After instantiation: ```rust use serenity::cache::Cache; let mut cache = Cache::new(); cache.settings_mut().max_messages(10); ``` And during runtime through the global cache: ```rust use serenity::CACHE; CACHE.write().settings_mut().max_messages(10); ```
* Remove extraneous spaces at the end of linesZeyla Hellyer2018-06-174-59/+59
|
* Fix links to the repoZeyla Hellyer2018-05-231-1/+1
| | | | | Fixes links to the repo from `https://github.com/zeyla/serenity` to `https://github.com/serenity-rs/serenity`.
* Replace (most) placeholders with actual namesacdenisSK2018-05-221-54/+54
|
* Remove a usage of Clone::cloneZeyla Hellyer2018-04-261-2/+2
|
* Fix panics on guild member update dispatchesZeyla Hellyer2018-04-261-10/+12
| | | | | | | | Fixes panics for Guild Member Update dispatches, a retrieval for the new version of the member sooner and checking that the member exists prior to dispatching. Closes #264.
* Remove empty whitespace at ends of linesZeyla Hellyer2018-04-251-3/+3
|
* Refactor imports/exports to use nested groups and better formattingacdenisSK2018-03-2911-35/+81
|
* Fix heartbeat checkingZeyla Hellyer2018-03-271-7/+2
| | | | | If a heartbeat acknowledgement is not received, then the shard should restart.
* Remove useless clones (#292)Maiddog2018-03-171-1/+1
|
* Fix no-cache standardframework compilation (#290)Lakelezz2018-03-151-1/+1
|
* Add documentation to `EventHandler`acdenisSK2018-02-191-2/+205
|
* Fix broken docs links caused by model mod changesZeyla Hellyer2018-01-314-20/+20
| | | | | Fix broken links caused by the `model` module changes in v0.5.0, which split up the module into sub-modules for better organization.
* Expose a client voice managerZeyla Hellyer2018-01-187-78/+268
|
* Use an InterMessage to communicate over gatewayZeyla Hellyer2018-01-187-24/+32
| | | | | | | Instead of communicating over the gateway in a split form of a `serde_json::Value` or a `client::bridge::gateway::ShardClientMessage`, wrap them both into a single enum for better interaction between the client, gateway, and voice modules.
* Fix ShardManager doctestZeyla Hellyer2018-01-101-11/+14
|
* Revert "Add `Client::user_id`"Zeyla Hellyer2018-01-101-9/+3
| | | | | | | | | | | This reverts commit 062ea86d5b0d9932207636d4a44a5357b079e79a. This change had the unintended side-effect of making tests with the Client impossible without hitting Discord's REST API for every test (even worse, while unauthorized). Knowing the user's ID on creation isn't _too_ important, and what was being done with that knowledge can be deferred to connection start.
* Simplify ShardManager creationZeyla Hellyer2018-01-103-119/+54
| | | | | | Instead of creating different `new` functions for every bridged feature combination, accept a struct of options. Structs can have conditional fields, unlike functions which can not have conditional arguments.
* Add `Client::user_id`Zeyla Hellyer2018-01-101-3/+10
| | | | | Add the user ID to the client. This can be used when initializing the framework on connection start, as well as the future voice manager.
* Remove `is_bot` boolean from frameworkZeyla Hellyer2018-01-101-1/+1
| | | | | The framework no longer needs the `is_bot` boolean state, since serenity now only supports bot users.
* Move `VecMap` to `utils`acdenisSK2018-01-021-3/+3
| | | | This also fixes no-builder compilation
* Resolve no-framework client compilationZeyla Hellyer2018-01-021-2/+2
|
* Update dispatch.rsZeyla Hellyer2018-01-021-1/+1
|
* Fix no-framework dispatchingZeyla Hellyer2018-01-021-1/+1
|
* Add an event for shard updatesZeyla Hellyer2018-01-016-47/+106
| | | | | Add an event in the EventHandler to be called when a shard updates its Connection Stage.
* Expose a method of retrieving shard status/latencyZeyla Hellyer2018-01-014-1/+52
| | | | | | This exposes a method of retrieving a shard's status and latency through the Shard Manager, as part of the existing Shard Runner Info struct. The Shard Runner will update this whenever it notices a change.
* Improve performance of builders even furtheracdenisSK2017-12-271-3/+3
| | | | | | By negating hashing altogether. The increase is around 1000-ish nanoseconds saved.
* Add missing trailing comma in matchZeyla Hellyer2017-12-171-1/+1
|
* Trim given token in Client::newZeyla Hellyer2017-12-171-0/+2
| | | | | Trims the token given as an argument in Client::new, which will strip away whitespace that might occur due to including the token from a file.
* Fix doc-tests and `single_zc`acdenisSK2017-12-171-5/+5
|
* Fix shards attempting to re-identify on their ownZeyla Hellyer2017-12-161-8/+24
| | | | | | | | | | Fix shards by taking away their responsibility to re-identify, instead shutting down shard runners and going through the shard queuer to restart a shard runner and its associated shard. This fixes the case where a running shard's session invalidates and re-IDENTIFYs within 5 seconds before queued shard starts, causing a cascading failure of sessions for new shards.
* Fix most clippy lints, take more refeerncesZeyla Hellyer2017-12-164-62/+63
| | | | | Fix clippy lints and subsequently accept references for more function parameters.
* Attempt to restart failed shard bootsZeyla Hellyer2017-12-162-18/+48
| | | | | | | | | | | | When the ShardQueuer fails to restart a shard (such as due to a network error, an issue on Discord's side, Cloudflare, etc.), it will now push the ID onto a queue. Every 5 seconds messages will attempt to be read from the receiver, and if one is not read after the timeout, a queued shard start will occur (if one is queued). This should fix a number of reconnection issues.
* Break up the model moduleZeyla Hellyer2017-12-165-23/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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}; ```
* Make `Context::edit_profile` slightly efficientacdenisSK2017-12-141-3/+3
|
* Shutdown everything on ShardManager::shutdown_allZeyla Hellyer2017-12-095-1/+17
| | | | | | | | | | Calling `ShardManager::shutdown_all` will now send a message to the shard queuer and shard monitor to shutdown. This will now cause `Client::start_connection` to exit. Additionally, `Client::start_connection` and related functions that call this (e.g. `Client::start_autosharded`) now return `Ok(())` on clean exits.
* Remove client close handleZeyla Hellyer2017-11-201-19/+38
| | | | | | | | | | | | | | | | | Remove the client's close handle. This was eclipsed by the `client::bridge::gateway::ShardManager`, which is a public interface giving full control over connected shards owned by the instance of the client (as opposed to the purpose of the handle which was a simple "shutdown" signal). Additionally, more documentation has been added to `Client::shard_manager`, now including a sample scenario of how to shutdown the bot after some amount of time has passed. Upgrade path: Refer to the documentation for `Client::shard_manager` on a sample scenario on how to switch from the close handle to the ShardManager.