aboutsummaryrefslogtreecommitdiff
path: root/src/model/webhook.rs
Commit message (Collapse)AuthorAgeFilesLines
* Use `to_`- and `as_`-methods instead of `get` and `find` on Id newtypesLakelezz2018-08-121-1/+11
|
* Fix all the dead links in the docsErk-2018-08-091-7/+7
|
* Fix some clippy lintsZeyla Hellyer2018-07-151-1/+1
| | | | | Some lints were not resolved due to causing API changes. Most lints in the framework were left unfixed.
* Remove extraneous spaces at the end of linesZeyla Hellyer2018-06-171-2/+2
|
* Refactor imports/exports to use nested groups and better formattingacdenisSK2018-03-291-2/+8
|
* Fix no-model compiler warningsZeyla Hellyer2018-01-101-1/+2
|
* Implement or derive Serialize on all modelsZeyla Hellyer2018-01-011-1/+1
|
* Improve performance of builders even furtheracdenisSK2017-12-271-1/+1
| | | | | | By negating hashing altogether. The increase is around 1000-ish nanoseconds saved.
* Break up the model moduleZeyla Hellyer2017-12-161-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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}; ```
* Re-order use statements alphabeticallyZeyla Hellyer2017-11-111-2/+2
|
* Slightly improve performance of buildersZeyla Hellyer2017-10-181-7/+4
| | | | | | | | | | | | | | | Builders would keep a `serde_json::Map<String, Value>`, which would require re-creating owned strings for the same parameter multiple times in some cases, depending on builder defaults and keying strategies. This commit uses a `std::collections::HashMap<&'static str, Value>` internally, and moves over values to a `serde_json::Map<String, Value>` when it comes time to sending them to the appropriate `http` module function. This saves the number of heap-allocated string creations on most builders, with specific performance increase on `builder::CreateMessage` and `builder::CreateEmbed` & co.
* `to_owned` -> `to_string`acdenisSK2017-10-091-3/+3
|
* Apply rustfmtZeyla Hellyer2017-09-181-4/+1
|
* Add ability to play DCA and Opus files. (#148)Maiddog2017-08-271-2/+5
|
* Revamp `RwLock` usage in the libacdenisSK2017-08-241-5/+2
| | | | Also not quite sure if they goofed rustfmt or something, but its changes it did were a bit bizarre.
* Apply rustfmtZeyla Hellyer2017-08-181-1/+4
|
* Change the config a bit, and a few nitpicksacdenisSK2017-07-271-10/+14
|
* rustfmtacdenisSK2017-07-271-23/+25
|
* Add 'wait' parameter to http::execute_webhookZeyla Hellyer2017-06-201-4/+5
| | | | | | The 'wait' parameter allows you to specify waiting for the Message to be sent prior to receiving a response, which will have Discord include the JSON representation of the Message in the body.
* Fix compilations across feature combinationsZeyla Hellyer2017-06-021-2/+4
|
* Restructure modulesZeyla Hellyer2017-05-221-25/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Switch to using serde for deserializationZeyla Hellyer2017-04-111-9/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Pass by reference where possibleZeyla Hellyer2017-02-281-2/+2
| | | | | | | A lot of the `rest` methods took - for example a Map - by value, where they could instead take a reference. While this only prevents one clone in the library, user-land code should no longer need to clone maps when using the `rest` module.
* Use Id methods where possibleAustin Hellyer2017-01-241-1/+1
|
* Switch to a mostly-fully OOP approachAustin Hellyer2017-01-231-13/+18
| | | | | | The context is now strictly in relation to the context of the current channel related to the event, if any. See Context::say for a list of events that the context can be used for.
* Improve docs and add new message builder methodsIllia K2016-11-281-5/+5
| | | | | Add documentation for some missing methods - such as Game methods - and add more methods to the Message Builder.
* Rename the `http` module to `rest`Austin Hellyer2016-11-251-21/+21
|
* Add state/framework/etc. conditional compile flagsAustin Hellyer2016-11-151-0/+4
| | | | | | | | | | | | | | | 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.
* Add internal moduleAustin Hellyer2016-11-141-1/+1
| | | | | Create a general `internal` module, and move `prelude_internal` to `internal::prelude`.
* Move the builders to the utilsAustin Hellyer2016-11-131-1/+1
| | | | | | | | | 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.
* Fix some clippy lintsAustin Hellyer2016-11-101-1/+1
|
* Add webhook supportAustin Hellyer2016-11-071-0/+168