Skip to content

Commit

Permalink
Merge changes from current (#190)
Browse files Browse the repository at this point in the history
* feature: subcommmand_required parameter (#170)

* Add Infallible to __NonExhaustive enum variants

* add: subcommmand_required

* Fix a few things

- The code was not properly formatted (`cargo fmt --all`)
- There was a redundant is_subcommand value added to a bunch of things (including find_command - this PR was a breaking change and would have belonged to the `next` branch! But since is_subcommand was redundant and I removed it, this PR becomes not-breaking again (which makes sense; this kind of small feature shouldn't need breaking changes))
- The is_subcommand check was in the wrong place. The parse_invocation is really only for parsing, not for any action. If it returns an error, it should be an error in _parsing_, not in execution or usage. And it also belongs after the track_edits related checks, because if a message was edited that poise isn't even allowed to care about, it shouldn't throw an error too (this would have been another problem with the is_subcommand check in parse_invocation)

* Improve text

---------

Co-authored-by: kangalioo <[email protected]>
Co-authored-by: xtfdfr <[email protected]>

* Added Support for Opening Modals as an MCI Response (#173)

* feat: added support for responding to an mci with a modal

* feat: added example, simplified modal send as mci interface

* fix: fixed example

* Some changes ™

- Move component modal example into modal.rs instead of making new file
- Make component modal example prefix_command too to catch any oversights that may make component modals rely on a slash command interaction being present (e.g. previously, execute_component_interaction took ApplicationContext and couldn't be invoked in prefix context at all)
- Deduplicate code between execute_modal and execute_component_interaction (and rename the latter to be clearer)
- Remove Modal::execute_component_interaction function in favor of free-standing execute_modal_on_component_interaction function - I want to avoid an explosion of utility trait functions for any combination of defaults yes/no, component yes/no... That said, I realize we're already halfway in this mess with execute and execute_with_defaults both existing so I'd also be open to go all the way and add execute_component_interaction and execute_component_interaction_with_defaults
- Add `impl AsRef<serenity::Context> for poise::Context` to make free-standing execute_modal_on_component_interaction function work well; and because it makes sense in general to have

---------

Co-authored-by: kangalioo <[email protected]>

* add `reply()` for `poise::context` (#183)

* fix the behavior of poise::reply::builder::CreateReply.reply

* unnecessary change by mistake

* change back to original

* add reply()

* remove reply_reply()

* Adhere to unwritten codebase conventions

Made on phone in GitHub's absolutely janky web UI, and untested. Let's see how this goes

---------

Co-authored-by: kangalio <[email protected]>

* Two dependency bumps (#186)

* Bump `tokio` to `1.25.1`

* Bump `env_logger` to `1.10.0`

* Bump `tokio` to `1.25.1`

* Allow passing cooldown config on demand

That way, you can have different cooldown durations depending on which user / guild / whatever is invoking the command

* Remove old `CooldownTracker` methods and migrate internals

- Renames `CooldownTracker::new_2` and `CooldownTracker::remaining_cooldown_2` to `CooldownTracker::new` and `CooldownTracker::remaining_cooldown` respectively.
- Adds a new `cooldown_config` field to `Command` wrapped in a Mutex to allow updating by the user
- Adds a new example using a command check to modify the `cooldown_config` on the `Command`
- updates `#[poise::command]` to new `Command` structure

* Bump MSRV to 1.63

Needed for dependency updates in #186 that
were done to resolve some `cargo audit`
vulnerabilities

---------

Co-authored-by: franuś <[email protected]>
Co-authored-by: kangalioo <[email protected]>
Co-authored-by: xtfdfr <[email protected]>
Co-authored-by: G0ldenSp00n <[email protected]>
Co-authored-by: B-2U <[email protected]>
Co-authored-by: Overzealous Lotus <[email protected]>
  • Loading branch information
7 people authored Sep 14, 2023
1 parent a033d14 commit cca5c13
Show file tree
Hide file tree
Showing 20 changed files with 493 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

include:
- name: MSRV
toolchain: 1.60.0
toolchain: 1.63.0
# don't do doctests because they rely on new features for brevity
command: cargo test --all-features --lib --tests

Expand Down
180 changes: 149 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ authors = ["kangalio <[email protected]>"]
edition = "2018"
name = "poise"
version = "0.5.5"
rust-version = "1.60.0"
rust-version = "1.63.0"
description = "A Discord bot framework for serenity"
license = "MIT"
repository = "https://github.com/serenity-rs/poise/"

[dependencies]
tokio = { version = "1.21.1", default-features = false } # for async in general
tokio = { version = "1.25.1", default-features = false } # for async in general
futures-core = { version = "0.3.13", default-features = false } # for async in general
futures-util = { version = "0.3.13", default-features = false } # for async in general
once_cell = { version = "1.7.2", default-features = false, features = ["std"] } # to store and set user data
Expand All @@ -27,9 +27,9 @@ version = "0.11.6"

[dev-dependencies]
# For the examples
tokio = { version = "1.21.1", features = ["rt-multi-thread"] }
tokio = { version = "1.25.1", features = ["rt-multi-thread"] }
futures = { version = "0.3.13", default-features = false }
env_logger = "0.9.0"
env_logger = "0.10.0"
fluent = "0.16.0"
intl-memoizer = "0.5.1"
fluent-syntax = "0.11"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Docs](https://img.shields.io/badge/docs-online-informational)](https://docs.rs/poise/)
[![Docs (git)](https://img.shields.io/badge/docs%20%28git%29-online-informational)](https://serenity-rs.github.io/poise/)
[![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Rust: 1.60+](https://img.shields.io/badge/rust-1.60+-93450a)](https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html)
[![Rust: 1.63+](https://img.shields.io/badge/rust-1.63+-93450a)](https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html)

# Poise
Poise is an opinionated Discord bot framework with a few distinctive features:
Expand Down
Loading

0 comments on commit cca5c13

Please sign in to comment.