| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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;
```
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
Some of the methods relied on the cache being present. Now, these
methods only conditionally require the cache to be compiled and
present.
The cache was mainly used for checking if the current user had
permission to perform operations.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| |
|
|
| |
Returns a Timespec of when the Id (or User) was created.
|
| |
|
|
|
|
|
| |
The roles method will search through the state and find full role data
for the member. This is essentially a shorthand for it. This does
perform a clone of the role data, but this will be optimized in the
future.
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
| |
This will search the state for the channel's associated guild, acting as
a shortcut.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This will allow comparing, for example, a `ChannelId` with a `u64`
directly, bypassing the need to do something like:
```rust
let channel_id = ChannelId(7);
assert!(channel_id.0 == 7);
// can now be replaced with:
assert!(channel_id == 7);
```
|
| |
|
|
|
| |
While this will use a slightly higher amount of memory, it will be
easier for users to use.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
This is for a little bit of ergonomics, and is of such a minute cost
that it is worth it to just directly decode the u32's received for
Role/Embed colours into the Colour struct.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Features are handed by Discord to guilds that meet requirements which
are most likely realistically arbitrary.
The 3 features at this moment are:
- INVITE_SPLASH
- VANITY_URL
- VIP_REGIONS
On decoding of the two guild structs, map these string values to enum
variants.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds two methods to the Attachment model:
- download: uses Hyper to download the attachment and return it as a vec
of bytes;
- download_to_directory: equivilant to `download`, except it will also
save the bytes to a file named equivilant to the filename in a given
directory.
Check the documentation for Attachment for more information and
examples:
<https://docs.austinhellyer.me/serenity.rs/latest/serenity/model/struct.Attachment.html>
|
| | |
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Convert all of the non-named anchors in docs to named anchors.
Example:
```md
Kicks a [`Member`](../model/struct.Member.html) from the specified
[`Guild`](../model/struct.Guild.html) if they are in it.
```
is now written as:
```md
Kicks a [`Member`] from the specified [`Guild`] if they are in it.
[`Guild`]: ../model/struct.Guild.html
[`Member`]: ../model/struct.Member.html
```
|
| |
|
|
|
|
| |
Most of the docs were linking to `enum.EnumName.html#VariantName.v`,
which should have been linking to
`enum.EnumName.html#variant.VariantName`.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add message reaction structs and an enum to differentiate between the
two types of reactions, as well as event decoding and event handlers
with dispatches.
The following is, more or less, what is added:
- `reactions` field to the `Message` struct;
- `MessageReaction` struct, which is a consolidated form of reaction,
containing the type of reaction, the number of them, and whether the
current user has performed that type of reaction;
- `Reaction`, a struct containing the information about a reaction
- `ReactionType`, an enum to differentiate between the two types of
reactions: `Custom` (a guild's custom emoji) and `Unicode` (twemoji);
- Decoding for `MESSAGE_REACTION_ADD` and `MESSAGE_REACTION_REMOVE`;
- Permission flag `ADD_REACTIONS`;
- `Message::react` method;
- Three `http` payload senders: `create_reaction`, `delete_reaction`,
and `get_reaction_users`;
- Three `Context` methods of equal names to the above.
|
| | |
|