aboutsummaryrefslogtreecommitdiff
path: root/src/client/error.rs
Commit message (Collapse)AuthorAgeFilesLines
* Remove extraneous spaces at the end of linesZeyla Hellyer2018-06-171-1/+1
|
* Refactor imports/exports to use nested groups and better formattingacdenisSK2018-03-291-2/+8
|
* Fix broken docs links caused by model mod changesZeyla Hellyer2018-01-311-1/+1
| | | | | Fix broken links caused by the `model` module changes in v0.5.0, which split up the module into sub-modules for better organization.
* rustfmtacdenisSK2017-07-271-3/+1
|
* Make client starts return an errorZeyla Hellyer2017-06-061-0/+4
| | | | | | When returning, the Client would return an Ok(()). Instead, return an error, since there is currently no reason the client would return under "okay" circumstances.
* Restructure modulesZeyla Hellyer2017-05-221-131/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Make `User.discriminator` a u16Zeyla Hellyer2017-04-251-3/+1
| | | | | | | | | Change the User struct's `discriminator` field to a u16 for performance. The User struct's `discriminator` field was previously a u16 but changed to a `String` for ease-of-use. Lately the library has been gearing more towards performance where possible while not sacrificing ergonomics _too much_ in most scenarios.
* Check for embed lengths on message sendsZeyla Hellyer2017-04-191-0/+3
| | | | | | | | | | | | | | | | | | | | | | 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.
* Remove selfbot supportZeyla Hellyer2017-04-051-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While selfbots have always been "roughly tolerated", lately they have been tolerated to less of a degree. The simple answer is to no longer support selfbots in any form. This is done for a few of reasons: 1) in anticipation of selfbots no longer being tolerated; 2) there are few reasons why one should make a selfbot in Rust and not a scripting language; 3) there are alternatives (i.e. discord-rs) that still support userbots. Selfbots are simply not a goal of the maintainer of serenity. Upgrade path: Don't use selfbots with serenity. Use discord-rs instead. The following has been removed: Enums: - `RelationshipType` Structs: - `FriendSourceFlags` - `ReadState` - `Relationship` - `SearchResult` - `SuggestionReason` - `Tutorial` - `UserConnection` - `UserGuildSettings` - `UserSettings` Removed the following fields: - `CurrentUser::mobile` - Ready::{ analytics_token, experiments, friend_suggestion_count, notes, read_state, relationships, tutorial, user_guild_settings, user_settings, } Removed the following methods: - `Client::login_user` Deprecated `Client::login_bot` in favour of `Client::login`. Removed `client::LoginType`. The following no longer take a `login_type` parameter: - `Context::new` - `Shard::new` `Shard::sync_guilds` has been removed. The `client::Error::{InvalidOperationAsBot, InvalidOperationAsUser}` variants have been removed. The following event handlers on `Client` have been removed: - `on_friend_suggestion_create` - `on_friend_suggestion_delete` - `on_relationship_add` - `on_relationship_remove` - `on_user_guild_settings_update` - `on_note_update` - `on_user_settings_update` The following `client::rest` functions have been removed: - `ack_message` - `edit_note` - `get_user_connections` - `search_channel_messages` - `search_guild_messages` The following `client::rest::ratelimiting::Route` variants have been removed: - `ChannelsIdMessagesSearch` - `GuildsIdMessagesSearch` - `UsersMeConnections` The following fields on `ext::cache::Cache` have been removed: - `guild_settings` - `relationships` - `settings` while the following methods have also been removed: - `update_with_relationship_add` - `update_with_relationship_remove` - `update_with_user_guild_settings_update` - `update_with_user_note_update` - `update_with_user_settings_update` The following methods have been removed across models: - `ChannelId::{ack, search}` - `Channel::{ack, search}` - `Group::{ack, search}` - `GuildChannel::{ack, search}` - `GuildId::{search, search_channels}` - `Guild::{search, search_channels}` - `Message::ack` - `PartialGuild::{search, search_channels}` - `PrivateChannel::{ack, search}` - `UserId::{delete_note, edit_note}` - `User::{delete_note, edit_note}` The following events in `model::events` have been removed: - `FriendSuggestionCreateEvent` - `FriendSuggestionDeleteEvent` - `MessageAckEvent` - `RelationshipAddEvent` - `RelationshipRemoveEvent` - `UserGuildSettingsUpdateEvent` - `UserNoteUpdateEvent` - `UserSettingsUpdateEvent` Consequently, the following variants on `model::event::Event` have been removed: - `FriendSuggestionCreate` - `FriendSuggestionDelete` - `MessageAdd` - `RelationshipAdd` - `RelationshipRemove` - `UserGuildSettingUpdate` - `UserNoteUpdate` - `UserSettingsUpdate` The `utils::builder::Search` search builder has been removed.
* Add slightly more documentationZeyla Hellyer2017-03-251-0/+8
|
* Handle unsuccessful responses before decodingZeyla Hellyer2017-02-111-1/+1
| | | | | | | Instead of assuming every request is successful, check that the class of the status is successful (2xx), and if not, return a `ClientError::InvalidRequest`, which is a renamed `ClientError::UnexpectedStatusCode`.
* Fix docs linksAustin Hellyer2017-01-241-4/+5
|
* Reboot shard on broken pipeAustin Hellyer2017-01-201-0/+1
| | | | | | If the receiver or sender breaks the pipe for one reason or another, shutdown both. Afterwards, close down the keepalive and perform a reboot of the shard.
* Add guild and channel searchAustin Hellyer2016-12-291-0/+3
|
* Improve docs and add new message builder methodsIllia K2016-11-281-4/+1
| | | | | Add documentation for some missing methods - such as Game methods - and add more methods to the Message Builder.
* Rename guild structs to Guild and PartialGuildAustin Hellyer2016-11-241-2/+2
|
* Rename the State to CacheAustin Hellyer2016-11-221-5/+5
|
* Re-organize the client moduleAustin Hellyer2016-11-211-0/+147
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.