| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
They do not work for bot users. So return a
`ClientError::InvalidOperationAsBot` if someone tries to.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 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));
```
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
| |
Create a general `internal` module, and move `prelude_internal` to
`internal::prelude`.
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
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 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.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
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`
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
Rather than completely dropping the connection, send a close code prior.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
These are aliases of their `http` module equivilants, so they aren't
needed, especially on the Context, where they are not associated with
the current context.
|
| |
|
|
|
|
| |
Most of the longer named methods were probably never going to be used,
but some of the longer aliased methods have been kept and the associated
alias removed.
|
| |
|
|
|
|
|
|
|
|
|
| |
If the reset was in the past by a second, then multiplication to
determine the difference in time to wait would result in somewhere
around the max value of u64 being multiplied by 1000, which caused a
multiplication overflow.
Instead, if the retry is in the past, just ignore it, as it would have
already passed, and continue on with the request, setting the remaining
requests allowed by the bucket to the known limit.
|
| |
|
|
|
| |
This was basically an alias to http::get_voice_regions and likely had
no use case.
|
| |
|
|
|
|
| |
The framework will lock on checking if it's initialized, and will not
be able to unlock a second time from within the same scope. Fix this
by unlocking it once and binding it.
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
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.
|