Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sticker packs, guild stickers, sticker routes #1395

Closed
wants to merge 59 commits into from

Conversation

drklee3
Copy link
Member

@drklee3 drklee3 commented Jun 17, 2021

Description

Adds the following features:

  • Add/modify/delete guild stickers
  • Fetch sticker information
  • Fetch list of all nitro stickers
  • Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module and to the root model module.

This also adds an additional mime and mime_guess dependencies as Discord requires the mime type on the file part when creating a sticker via multipart/form-data requests otherwise it will return a 500 Internal Server Error. This dependency is also used by reqwest internally.

Relevant documentation:

Tested

  • Sending / receiving stickers in messages
  • Get / create / edit / delete sticker

nickelc and others added 11 commits June 9, 2021 16:58
This commit removes the `Box` around the framework, allowing to `as`-cast for the `ClientBuilder::framework_arc` method.
The `as`-cast is now performed in the method itself, accepting a generic framework instead, easing the use of the API.
This adds support for parsing json with the `simd-json` crate for increased performance.
However, it must be enabled with the `simd-json` feature flag, as not all processors support
all SIMD instructions. In addition, the minimum-supported Rust version has been increased to 1.49.
…#1344)

Closes serenity-rs#876. 

The dispatch error hook now receives a fourth parameter with the command name.
This commit makes it possible to add new attachments to a message when editing it.

This commit:
- creates a new method `Http::edit_message_and_attachments` (that method is to `edit_message` what `send_files` is to `send_message`);
  - there's a lot of duplication between that new method and `Http::edit_message_and_attachments` and `Http::send_files`, but I don't know enough about serenity's http design to improve the situation;
- changes calls of `Http::edit_message` to `Http::edit_message_and_attachments` where appropriate;
- creates a new method `EditMessage::attachment` to add a new attachment;
- adds a new field to `EditMessage` which stores new attachments (breaking change); 
- adds a lifetime parameter to `EditMessage` (breaking change);
- moves the `AttachmentType` serialization into an HTTP form part into a function to avoid code duplication.
Prevents changing embed colours to black when editing a message.

When an embed colour isn't provided when creating a message, the API returns messages with colour as undefined for default colour. The colour field has the `#[serde(default)]`  attribute, which changes that into a `0` instead.
@drklee3 drklee3 added discord feature Related to Discord's functionality. model Related to the `model` module. http Related to the `http` module. labels Jun 17, 2021
src/http/client.rs Outdated Show resolved Hide resolved
tylerd008 and others added 5 commits June 29, 2021 13:33
…ty-rs#1412)

This changes the return type of the default help commands from `Option` to `Result` to allow the caller to decide how they want to present the error that occurred when sending the response.
This deserializes `Guild` channels from `GuildCreate` as the `Channel` enum instead of `GuildChannel`. This also prevents the merging of guild channels and categories in `Cache::channels` when they should be separate.

This also correctly updates the guild channels in the cache (e.g. when using `Message::guild(ctx)`) instead of *only* `Cache::categories`.

Additionally, this is a breaking change as `Guild::channels` has been changed from `HashMap<ChannelId, GuildChannel>` to `HashMap<ChannelId, Channel>`.
This commit removes the `Shard::shutdown` field and the `Shard::is_shutdown` method. The method always returned false as `Shard::shutdown` was never modified anywhere, which left the method useless.
…nity-rs#1416)

This adds a Cargo configuration file that defines flags for every invocation of `rustc` on Serenity and its dependencies. This removes the need to explicitly specify those flags when building the library, especially when testing `simd-json` code.

Fixes serenity-rs#1415
src/model/sticker.rs Outdated Show resolved Hide resolved
src/model/utils.rs Outdated Show resolved Hide resolved
This bakes multipart forms into `Request`s when making HTTP calls to Discord's API for sending attachments. As a result, this standardises the behaviour for endpoints that allow you to send attachments to use the same ratelimiting code as every other endpoint, rather than those endpoints performing raw requests and bypassing the ratelimiter.

Fixes serenity-rs#1269
@drklee3 drklee3 added command_attr Related to the `command_attr` crate. utils Related to the `utils` module. labels Jul 5, 2021
@drklee3 drklee3 marked this pull request as ready for review July 8, 2021 05:07
arqunis added a commit to arqunis/serenity that referenced this pull request Jul 10, 2021
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
@arqunis
Copy link
Member

arqunis commented Jul 10, 2021

This has been manually merged: 744bc13.

@arqunis arqunis closed this Jul 10, 2021
arqunis added a commit to arqunis/serenity that referenced this pull request Jul 11, 2021
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
arqunis pushed a commit to arqunis/serenity that referenced this pull request Jul 11, 2021
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
arqunis pushed a commit to arqunis/serenity that referenced this pull request Aug 9, 2021
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
arqunis pushed a commit to arqunis/serenity that referenced this pull request Sep 8, 2021
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
arqunis pushed a commit to arqunis/serenity that referenced this pull request Sep 25, 2021
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
arqunis pushed a commit to arqunis/serenity that referenced this pull request Sep 30, 2021
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
arqunis pushed a commit to arqunis/serenity that referenced this pull request Oct 29, 2021
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
arqunis pushed a commit to arqunis/serenity that referenced this pull request Nov 15, 2021
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
arqunis pushed a commit to arqunis/serenity that referenced this pull request Nov 15, 2021
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
arqunis pushed a commit to arqunis/serenity that referenced this pull request Dec 22, 2021
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
arqunis pushed a commit to arqunis/serenity that referenced this pull request Dec 23, 2021
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
@drklee3 drklee3 deleted the guild-stickers branch January 13, 2022 00:16
arqunis pushed a commit to arqunis/serenity that referenced this pull request Jan 23, 2022
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
arqunis pushed a commit to arqunis/serenity that referenced this pull request Mar 1, 2022
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
arqunis pushed a commit to arqunis/serenity that referenced this pull request Mar 15, 2022
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
arqunis pushed a commit to arqunis/serenity that referenced this pull request Apr 2, 2022
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
arqunis pushed a commit to arqunis/serenity that referenced this pull request Apr 18, 2022
…renity-rs#1395)

This adds the following features:

* Add/modify/delete guild stickers
* Fetch sticker information
* Fetch list of all nitro stickers
* Sending stickers in message (up to 3)

Breaking change as sticker module is moved out of the channel module
and to the root model module.

This also adds an additional `mime` and `mime_guess` dependencies as
Discord requires the mime type on the file part when creating a sticker
via multipart/form-data requests otherwise it will return a 500 Internal
Server Error. This dependency is also used by `reqwest` internally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builder Related to the `builder` module. client Related to the `client` module. command_attr Related to the `command_attr` crate. discord feature Related to Discord's functionality. http Related to the `http` module. model Related to the `model` module. utils Related to the `utils` module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants