aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Break up the model moduleZeyla Hellyer2017-12-1661-411/+505
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `model` module has historically been one giant module re-exporting all of the model types, which is somewhere around 100 types. This can be a lot to look at for a new user and somewhat overwhelming, especially with a large number of fine-grained imports from the module. The module is now neatly split up into submodules, mostly like it has been internally since the early versions of the library. The submodules are: - application - channel - error - event - gateway - guild - id - invite - misc - permissions - prelude - user - voice - webhook Each submodule contains types that are "owned" by the module. For example, the `guild` submodule contains, but not limited to, Emoji, AuditLogsEntry, Role, and Member. `channel` contains, but not limited to, Attachment, Embed, Message, and Reaction. Upgrade path: Instead of glob importing the models via `use serenity::model::*;`, instead glob import via the prelude: ```rust use serenity::model::prelude::*; ``` Instead of importing from the root model module: ```rust use serenity::model::{Guild, Message, OnlineStatus, Role, User}; ``` instead import from the submodules like so: ```rust use serenity::model::channel::Message; use serenity::model::guild::{Guild, Role}; use serenity::model::user::{OnlineStatus, User}; ```
* Revamp the internals of `Args`acdenisSK2017-12-163-128/+156
| | | | Fixes #180, however this partially breaks `single_zc` and `multiple_quoted`, but since they're minor it's better to fix them later for now.
* Fix deserialization of `Guild::application_id`Zeyla Hellyer2017-12-152-2/+4
| | | | | | | Fix the deserialization of the `Guild::application_id` structfield. Additionally, create a new ID type for it. A test has been added for this.
* Change type of a couple Guild/PartialGuild fieldsZeyla Hellyer2017-12-153-20/+44
| | | | | | Changes the types of `Guild` and `PartialGuild`'s `default_message_notifications` and `mfa_level` structfields to be a bit more type-strong.
* Add missing fields to Guild modelZeyla Hellyer2017-12-151-0/+46
| | | | | | | | Adds the following missing fields to the Guild model: - `application_id` - `explicit_content_filter` - `system_channel_id`
* Make `Context::edit_profile` slightly efficientacdenisSK2017-12-141-3/+3
|
* Remove the `Box<Command>` implacdenisSK2017-12-111-22/+0
| | | | | This was included back then as an afterthought about this impl from a user perspective, not from the lib's. Plus it's unlikely we'll be using this in the near future.
* Use a macro to generate FromStr implsacdenisSK2017-12-101-177/+92
|
* Shutdown everything on ShardManager::shutdown_allZeyla Hellyer2017-12-095-1/+17
| | | | | | | | | | Calling `ShardManager::shutdown_all` will now send a message to the shard queuer and shard monitor to shutdown. This will now cause `Client::start_connection` to exit. Additionally, `Client::start_connection` and related functions that call this (e.g. `Client::start_autosharded`) now return `Ok(())` on clean exits.
* Merge branch 'branch-v0.4.5' into v0.5.0Zeyla Hellyer2017-12-092-33/+4
|\
| * Release v0.4.5v0.4.5Zeyla Hellyer2017-12-091-2/+1
| |
| * Remove EditRole::default implementationZeyla Hellyer2017-12-091-29/+1
| | | | | | | | | | Removes the custom implementation for `EditRole`, instead deriving Default.
| * Fix remaining deserializersZeyla Hellyer2017-12-091-2/+2
| | | | | | | | | | | | Following up on the recent commit to fix the snowflake types' deserializers, this commit fixes the rest of the library's usage of deserializers in the same manner.
| * Fix snowflake deserializerZeyla Hellyer2017-12-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes snowflake deserializers (ChannelId, UserId, etc.) by switching from a usage of `deserialize_u64` to `deserialize_any`. Our usage of `deserialize_u64` was incorrect and the erroneous behaviour was fixed in serde_json v1.0.8. We were essentially telling serde that the received type was a u64, when in fact it can be multiple types (strings, u64, or an i64 just in case). This resulted in errors like: ``` Client error: Json(ErrorImpl { code: Message("invalid type: string \"317727377985634305\", expected identifier"), line: 1, column: 100 }) ``` Due to this, simple operations such as even connecting a client failed.
* | Fix snowflake deserializerZeyla Hellyer2017-12-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes snowflake deserializers (ChannelId, UserId, etc.) by switching from a usage of `deserialize_u64` to `deserialize_any`. Our usage of `deserialize_u64` was incorrect and the erroneous behaviour was fixed in serde_json v1.0.8. We were essentially telling serde that the received type was a u64, when in fact it can be multiple types (strings, u64, or an i64 just in case). This resulted in errors like: ``` Client error: Json(ErrorImpl { code: Message("invalid type: string \"317727377985634305\", expected identifier"), line: 1, column: 100 }) ``` Due to this, simple operations such as even connecting a client failed. (cherry picked from commit 77f462ea2044ef7d2d12fd1289ea75a6a33cb5dd)
* | Fall back to `str::parse` on `ChannelId` as wellacdenisSK2017-12-061-7/+56
| | | | | | | | Also give an actual error type for `Channel` too.
* | Make the comment for the `AsRef` impl more clearacdenisSK2017-12-061-1/+3
| |
* | Use `AsRef` instead of just `&MessageId`acdenisSK2017-12-061-1/+1
| |
* | Add the `VIEW_AUDIT_LOG` permission (#229)Lakelezz2017-12-041-0/+8
| |
* | Tune down repetition with a macroacdenisSK2017-11-301-56/+31
| |
* | Fix whitespacing and change `and` to `or`. (#228)Lakelezz2017-11-301-2/+2
| |
* | Make help-commands customisable (#227)Lakelezz2017-11-307-77/+468
| |
* | Use `ToString`'s blanket impl for `Display`sacdenisSK2017-11-273-5/+5
| |
* | Do a temporary fix for options for commands created in the `command!` macroacdenisSK2017-11-241-1/+24
| |
* | Convert from macro to ? (#226)Mei Boudreau2017-11-233-10/+2
| |
* | Add `before`/`after` middleware to `Command`acdenisSK2017-11-232-1/+36
| |
* | Actually remove the `init` call in `CreateCommand`acdenisSK2017-11-211-5/+1
| |
* | Add a way to execute code when a command is registeredacdenisSK2017-11-214-5/+20
| |
* | Remove client close handleZeyla Hellyer2017-11-201-19/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the client's close handle. This was eclipsed by the `client::bridge::gateway::ShardManager`, which is a public interface giving full control over connected shards owned by the instance of the client (as opposed to the purpose of the handle which was a simple "shutdown" signal). Additionally, more documentation has been added to `Client::shard_manager`, now including a sample scenario of how to shutdown the bot after some amount of time has passed. Upgrade path: Refer to the documentation for `Client::shard_manager` on a sample scenario on how to switch from the close handle to the ShardManager.
* | Fix no-gateway compilationZeyla Hellyer2017-11-201-3/+1
| |
* | Add `help()` to `CreateGroup`. (#225)Lakelezz2017-11-203-14/+35
| |
* | Have `on`'s docs actually use itselfacdenisSK2017-11-201-4/+4
| | | | | | | | Fixes #224
* | Add an impl for `Fn(&mut Context, &Message, Args)`acdenisSK2017-11-203-20/+13
| |
* | Add the `pub` modifieracdenisSK2017-11-191-3/+3
| |
* | Implement Deserialize for {,Gateway,Voice}EventZeyla Hellyer2017-11-194-179/+518
| | | | | | | | | | | | | | | | | | | | | | Implement Deserialize for `model::event::GatewayEvent` and `model::event::VoiceEvent`, and derive it for `model::event::Event`. Due to the natural potential slowness of deserializing into`Event` (attempting to deserialize into each variant until successful), a function named `model::event::deserialize_event_with_type` is provided for quickly deserializing into a known type if the dispatch type is known.
* | Add `model::Reaction::user`Zeyla Hellyer2017-11-181-3/+13
| | | | | | | | | | | | Add a `user` method to `Reaction::user`, which retrieves the User who made the reaction. This will check the cache for the user and, if either disabled or not found, falls back to hitting the REST API.
* | Add `model::Reaction::channel`Zeyla Hellyer2017-11-181-0/+15
| | | | | | | | | | | | Adds a `channel` method to `model::Reaction`, which retrieves the channel the reaction was made in from the Cache, falling back to hitting the REST API if one was not found (or the cache is disabled).
* | Alphabetize Reaction methodsZeyla Hellyer2017-11-181-14/+14
| |
* | Document that Reaction methods that hit the APIZeyla Hellyer2017-11-181-2/+8
| | | | | | | | | | | | | | Documents that the following `model::Reaction` methods hit the REST API: - `message` - `users`
* | Add a method to get a message from a reaction (#220)Maiddog2017-11-191-0/+10
| |
* | Fix framework doctestsZeyla Hellyer2017-11-182-6/+6
| | | | | | | | | | | | | | | | | | | | | | Fixes the following doctests for the changes introduced in commit [f10b9d7]: - client::Client::with_framework - framework::standard::configuration::Configuration::disabled_commands - framework::standard::configuration::Configuration::dynamic_prefix [f10b9d7]: f10b9d77f0b94864fa20688e3c99de6cec7ca6f9
* | Add `cmd` to `Create(Command|Group)`acdenisSK2017-11-183-19/+49
| |
* | Use a private function to reduce repetitionacdenisSK2017-11-171-21/+11
| |
* | Add the new game types (#219)Mei Boudreau2017-11-161-0/+62
| |
* | impl From<&Path> for http::AttachmentTypeZeyla Hellyer2017-11-161-0/+6
| |
* | Fix doc-testsacdenisSK2017-11-166-14/+33
| |
* | Document that application owners bypass checks (#218)Fenhl2017-11-161-0/+2
| |
* | Change most of the framework to use trait-based-commandsacdenisSK2017-11-155-172/+243
| |
* | Use the threadpool for framework command executionZeyla Hellyer2017-11-134-173/+326
| | | | | | | | | | | | | | Instead of executing framework commands in the shard runner thread (potentially blocking the shard runner from reading new messages over the websocket and heartbeating), dispatch framework commands to the shard runner's threadpool.
* | Fix strange behaviour when the prefix has spaces (#215)Uninteresting Account2017-11-131-14/+10
| |