| Commit message (Collapse) | Author | Age | Files | Lines |
| |\ |
|
| | | |
|
| | | |
|
| | | |
|
| | |\ |
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Rewrites the library to use Futures. This rewrites all of the gateway,
client, cache, most model methods, HTTP, and in a later commit the
framework and voice.
HTTP has been mostly rewritten to be ergonomic so that it can be used by
the user, and has been upgraded to hyper v0.11.
The gateway now uses `tokio-tungstenite` v0.4.
The client isn't yet in a working state.
The models now have a `client` optionally attached to them to make use
of `http` and `cache`-utilizing methods. The client isn't needed, in the
case that someone is using the library just to deserialize models.
The cache is now built around `Rc`s and `RefCell`s, instead of `Arc`s
and `RwLock`s.
Refer to example 01 for a working example. Much of the library still
doesn't work.
|
| | | |
| | |
| | |
| | |
| | | |
Fix broken links caused by the `model` module changes in v0.5.0, which
split up the module into sub-modules for better organization.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Adds support for parsing Rich Presences.
This can not be used for setting activities with bots.
Upgrade path:
Basically change your import and usage from
`serenity::model::gateway::Game` to
`serenity::model::gateway::Activity`.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Change the builders so that they are now mutably borrowed, accepting
`&mut self` instead of `self`. Their methods now return `()` instead of
`Self`.
Upgrade path:
Change code such as the following:
```rust
channel.send_message(|m| m
.embed(|e| e
.description("test")
.title("title")));
```
to the following style:
```rust
channel.send_message(|mut m| {
m.embed(|mut e| {
e.description("test");
e.title("title");
e
});
m
});
```
Closes #159.
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | | |
Fixes links to the repo from `https://github.com/zeyla/serenity` to
`https://github.com/serenity-rs/serenity`.
|
| | | | |
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | | |
|
| | | | |
|
| | |/
|/|
| |
| |
| | |
If a heartbeat acknowledgement is not received, then the shard should
restart.
|
| | | |
|
| | | |
|
| | | |
|
| |/
|
|
|
| |
Fix broken links caused by the `model` module changes in v0.5.0, which
split up the module into sub-modules for better organization.
|
| | |
|
| |
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
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 the user ID to the client. This can be used when initializing the
framework on connection start, as well as the future voice manager.
|
| |
|
|
|
| |
The framework no longer needs the `is_bot` boolean state, since serenity
now only supports bot users.
|
| |
|
|
| |
This also fixes no-builder compilation
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
Add an event in the EventHandler to be called when a shard updates its
Connection Stage.
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
By negating hashing altogether.
The increase is around 1000-ish nanoseconds saved.
|
| | |
|
| |
|
|
|
| |
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 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 clippy lints and subsequently accept references for more function
parameters.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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};
```
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
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 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.
|
| |
|
|
|
|
|
|
|
|
|
| |
Implement Deserialize for `model::event::GatewayEvent` and
`model::event::VoiceEvent`, and derive it for `model::event::Event`.
Due to the natural potential slowness of deserializing into`Event`
(attempting to deserialize into each variant until successful), a
function named `model::event::deserialize_event_with_type` is provided
for quickly deserializing into a known type if the dispatch type is
known.
|
| |
|
|
|
|
|
|
|
|
|
| |
Fixes the following doctests for the changes introduced in commit
[f10b9d7]:
- client::Client::with_framework
- framework::standard::configuration::Configuration::disabled_commands
- framework::standard::configuration::Configuration::dynamic_prefix
[f10b9d7]: f10b9d77f0b94864fa20688e3c99de6cec7ca6f9
|
| | |
|
| |
|
|
|
|
|
| |
Instead of executing framework commands in the shard runner thread
(potentially blocking the shard runner from reading new messages over
the websocket and heartbeating), dispatch framework commands to the
shard runner's threadpool.
|