| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
| |
Fixes links to the repo from `https://github.com/zeyla/serenity` to
`https://github.com/serenity-rs/serenity`.
|
| | |
|
| |
|
|
|
| |
This makes them easier to be found by tools like rls.
Also update struct inits to use the shorthand version for `x: x`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix Speaking state, use latest voice API version
* Speaking state would remain stuck on after playing particularly long
stretches of audio. So far as I can tell, playing 5 frames of silence
BEFORE changing the state seems to do the trick.
* Added new constant to make sure the library uses v3 of the voice api,
which it is written for.
* Heartbeat interval adjusted by * .75 as recommended by Discord.
* Initial version of new Audio wrapper.
* Single audio file case, as before..
* Loop over all available audio samples.
* Combine audio streams, account for volume.
* Cheaper explicit Opus silence frames.
As per Discord's recommendation, use a well-known 3-byte silence frame when needed.
* A bit of cleanup
Cleanup some of the code, rename some short-form fields to longer forms
(e.g. `s/src/source`), and remove a breaking change.
`Handler::play` was changed to return `LockedAudio` instead of `()`. If
someone were to rely on `Handler::play` returning `()`, the return type
change would break their code. Instead, this functionality has been
added to a new `Handler::play_returning` function.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
Embeds can now have a combined textual length of 6000, up from 4000.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Modules are now separated into a fashion where the library can be used
for most use cases, without needing to compile the rest.
The core of serenity, with no features enabled, contains only the
struct (model) definitions, constants, and prelude. Models do not have
most functions compiled in, as that is separated into the `model`
feature.
The `client` module has been split into 3 modules: `client`, `gateway`,
and `http`.
`http` contains functions to interact with the REST API. `gateway`
contains the Shard to interact with the gateway, requiring `http` for
retrieving the gateway URL. `client` requires both of the other features
and acts as an abstracted interface over both the gateway and REST APIs,
handling the event loop.
The `builder` module has been separated from `utils`, and can now be
optionally compiled in. It and the `http` feature are required by the
`model` feature due to a large number of methods requiring access to
them.
`utils` now contains a number of utilities, such as the Colour struct, the
`MessageBuilder`, and mention parsing functions.
Each of the original `ext` modules are still featured, with `cache` not
requiring any feature to be enabled, `framework` requiring the `client`,
`model`, and `utils`, and `voice` requiring `gateway`.
In total the features and their requirements are:
- `builder`: none
- `cache`: none
- `client`: `gateway`, `http`
- `framework`: `client`, `model`, `utils`
- `gateway`: `http`
- `http`: none
- `model`: `builder`, `http`
- `utils`: none
- `voice`: `gateway`
The default features are `builder`, `cache`, `client`, `framework`,
`gateway`, `model`, `http`, and `utils`.
To help with forwards compatibility, modules have been re-exported from
their original locations.
|
| |
|
|
|
|
|
|
|
|
| |
When message type 7 is received from the gateway, transform the content
if the type is 7 to a proper greeting.
Additionally, when the type is 6, provide a proper content notifying that a
user has pinned a message to the channel.
These transformations are not done at REST-level when retrieving messages, and
are instead done in `ChannelId::message` and `ChannelId::messages`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Due to the maximum length of the textual content of an embed being 4000,
this should be checked prior to message sending.
Embeds have a fairly new limit of only being 4000 character long, at
maximum. The length of these fields - where present - should be summed,
so that bad requests are not made with embeds that are too large in
text.
The fields that count as "textual" includes:
- author name
- description
- `name` and `value` of each field
- footer text
- title
If this exceeds the limit - currently at 4000 unicode codepoints - then
a `ClientError::EmbedTooLarge` will be returned, including the number
of codepoints overflowing.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current build system is rudimentary, incomplete, and rigid, offering
little in the way of customizing decoding options.
To solve this, switch to using serde-derive with custom Deserialization
implementations. This allows very simple deserialization when special
logic does not need to be applied, yet allows us to implement our own
deserialization logic when required.
The problem with the build system was that it built enums and structs
from YAML files. This is not so good, because it requires creating a
custom build system (which was rudimentary), creating "special struct
configs" when logic needed to be ever so slightly extended (rigid), and
if special logic needed to be applied, a custom deserialization method
would have been needed to be made anyway (incomplete).
To solve this, switch to serde-derive and implementing Deserialize
ourselves where required. This reduces YAML definitions that might
look like:
```yaml
---
name: Group
description: >
A group channel, potentially including other users, separate from a [`Guild`].
[`Guild`]: struct.Guild.html
fields:
- name: channel_id
description: The Id of the group channel.
from: id
type: ChannelId
- name: icon
description: The optional icon of the group channel.
optional: true
type: string
- name: last_message_id
description: The Id of the last message sent.
optional: true
type: MessageId
- name: last_pin_timestamp
description: Timestamp of the latest pinned message.
optional: true
type: string
- name: name
description: The name of the group channel.
optional: true
type: string
- name: owner_id
description: The Id of the group channel creator.
type: UserId
- name: recipients
description: Group channel's members.
custom: decode_users
t: UserId, Arc<RwLock<User>>
type: hashmap
```
to:
```rs
/// A group channel - potentially including other [`User`]s - separate from a
/// [`Guild`].
///
/// [`Guild`]: struct.Guild.html
/// [`User`]: struct.User.html
pub struct Group {
/// The Id of the group channel.
#[serde(rename="id")]
pub channel_id: ChannelId,
/// The optional icon of the group channel.
pub icon: Option<String>,
/// The Id of the last message sent.
pub last_message_id: Option<MessageId>,
/// Timestamp of the latest pinned message.
pub last_pin_timestamp: Option<String>,
/// The name of the group channel.
pub name: Option<String>,
/// The Id of the group owner.
pub owner_id: UserId,
/// A map of the group's recipients.
#[serde(deserialize_with="deserialize_users")]
pub recipients: HashMap<UserId, Arc<RwLock<User>>>,
}
```
This is much simpler and does not have as much boilerplate.
There should not be any backwards incompatible changes other than the
old, public - yet undocumented (and hidden from documentation) - decode
methods being removed. Due to the nature of this commit, field names may
be incorrect, and will need to be corrected as deserialization errors
are found.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Calls and guild sync are essentially leftovers from selfbot support
removal, the former moreso.
Removes the following `model::event` structs:
- CallCreateEvent
- CallDeleteEvent
- CallUpdateEvent
- GuildSyncEvent
which also removes the following `model::event::Event` variants:
`client::gateway::Shard::sync_calls` has been removed.
The following `client::Client` methods have been removed:
- `on_call_create`
- `on_call_delete`
- `on_call_update`
- `on_guild_sync`
Removes the following items on `ext::cache::Cache`:
```
ext::cache::Cache::{
// fields
calls,
// methods
get_call,
update_with_call_create,
update_with_call_delete,
update_with_call_update,
update_with_guild_sync,
}
```
Voice structs and methods now take solely a `guild_id` instead of a
`target`, due to the handling of 1-on-1 and group calls being removed.
This continues off commit d9118c0.<Paste>
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
Create a general `internal` module, and move `prelude_internal` to
`internal::prelude`.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
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.
|
| | |
|
| |
|