aboutsummaryrefslogtreecommitdiff
path: root/src/constants.rs
Commit message (Collapse)AuthorAgeFilesLines
* Fix all the dead links in the docsErk-2018-08-091-1/+1
|
* 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`.
* Update join messages constantZeyla Hellyer2018-04-271-0/+18
|
* Change the way ids and some enums are made (#295)Leah2018-03-231-40/+68
| | | | | This makes them easier to be found by tools like rls. Also update struct inits to use the shorthand version for `x: x`.
* Multiple audio stream playback, volume control, pausingKyle Simpson2018-01-311-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Make help-commands customisable (#227)Lakelezz2017-11-301-1/+1
|
* Change the config a bit, and a few nitpicksacdenisSK2017-07-271-3/+5
|
* rustfmtacdenisSK2017-07-271-22/+24
|
* Update max embed lengthZeyla Hellyer2017-06-221-1/+1
| | | | Embeds can now have a combined textual length of 6000, up from 4000.
* Extract Discord close codes to constantsZeyla Hellyer2017-06-211-0/+47
|
* Restructure modulesZeyla Hellyer2017-05-221-47/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Handle message type 7 (member join)illia k2017-05-221-0/+26
| | | | | | | | | | 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`.
* Check for embed lengths on message sendsZeyla Hellyer2017-04-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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.
* Switch to using serde for deserializationZeyla Hellyer2017-04-111-56/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove support for group calls and guild syncZeyla Hellyer2017-04-091-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Abstract large threshold number to a constantAustin Hellyer2017-01-241-0/+2
|
* Code style cleanupAustin Hellyer2017-01-081-46/+0
|
* Fix rs suffixIllia2017-01-051-1/+1
|
* Add guild and channel searchAustin Hellyer2016-12-291-0/+92
|
* Clean up the codebaseAustin Hellyer2016-11-291-113/+64
|
* Add voice connection supportAustin Hellyer2016-11-141-4/+6
|
* Add internal moduleAustin Hellyer2016-11-141-1/+1
| | | | | Create a general `internal` module, and move `prelude_internal` to `internal::prelude`.
* Add a check for message content lengthAustin Hellyer2016-11-121-0/+2
| | | | | | | | | | 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.
* Fix some clippy lintsAustin Hellyer2016-11-101-2/+1
|
* Add REST error code enumAustin Hellyer2016-11-091-0/+87
|
* Map op codes via a macroAustin Hellyer2016-11-091-64/+22
|
* Add a prelude for userlandAustin Hellyer2016-11-051-1/+1
| | | | | | | 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.
* Abstract opcodes to enumsAustin Hellyer2016-10-221-0/+98
|
* Initial commitAustin Hellyer2016-10-181-0/+9