Skip to content

Commit

Permalink
Upgrade poise current to include poise next and serenity-next (#224)
Browse files Browse the repository at this point in the history
* Optionally display subcommands in help menu

Only one recursion level deep so far because infinite recursion would have been a pain and I don't even know if that's what users want so it's single recursion level for now and if someone complains I'll go through the async recursion trouble

* Make a bunch of structs non_exhaustive...

...and rename AutocompleteChoice.name to label (I think it fits better)

* Forgot enums (while applying non_exhaustive)

* Rework of builtins::help() (#161)

* Rework of builtins::help()

* Use find_command instead of duplicating code

* Fix env variable `set` -> `export` for Unix

* Fix unneeded mut

* cargo fmt

---------

Co-authored-by: kangalioo <jannik.a.schaper@web.de>

* Add HelpConfiguration:include_description

#161 changed single help command to include description. This commit makes it optional (but keeps the new behavior as default)

* Fix cargo test

* Change Command field types

- category: `Option<&'static str>` -> `Option<String>`
- help_text: `Option<fn() -> String>` -> `Option<String>`
- aliases: `&'static [&'static str]` -> `Vec<String>`
- context_menu_name: `Option<&'static str>` -> `Option<String>`

The &'static references meant you couldn't dynamically change those values which is very powerful so better do this breaking change now than potentially later.
It's not like it hurts to use String and Vec here due to the allocations - every bot will have a two-digit, max three-digit number of Command instances anyways and they will all be initialized on startup.

Also, the fn() in help_text was really ugly and was just a hack for rustbot to share common parts of the help text. But this should be done by just changing the help_text field in main() or whatever. Actually though, I was able to keep the #[command] attribute's help_text_fn field working. But it runs the function at command construction time now instead of on demand when help is called. So, behavior change technically

* Add ChoiceParameter trait instead of direct impls

Fixes #126

* Fix with simd-json (amend to 8471b6e)

* Refinements to builtins::help (#167)

* Refinements to builtins::help

* Make rustfmt happy

* Make MSRV happy

---------

Co-authored-by: Rogier 'DocWilco' Mulhuijzen <github@bsdchicks.com>

* Make FrameworkError and SlashArgError variants non_exhaustive

* Migrate cooldowns to new version

* Add CooldownContext struct to make Cooldowns usable in more situations (#175)

* Convert Cooldowns to use HashMap instead of OrderedMap for better scaling (#180)

* Convert poise builders to new serenity style

* Swap to serenity 0.12.0

* Bump MSRV to match serenity's

---------

Co-authored-by: kangalioo <jannik.a.schaper@web.de>
Co-authored-by: docwilco <66911096+docwilco@users.noreply.github.com>
Co-authored-by: Rogier 'DocWilco' Mulhuijzen <github@bsdchicks.com>
Co-authored-by: scottbot95 <scottbot95@gmail.com>
  • Loading branch information
5 people authored Nov 28, 2023
1 parent 6b1bb9d commit 835a016
Show file tree
Hide file tree
Showing 62 changed files with 2,545 additions and 2,150 deletions.
6 changes: 3 additions & 3 deletions .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.63.0
toolchain: 1.74.0
# don't do doctests because they rely on new features for brevity
# copy known Cargo.lock to avoid random dependency MSRV bumps to mess up our test
command: cp .github/Cargo-msrv.lock Cargo.lock && cargo test --all-features --lib --tests
Expand All @@ -40,7 +40,7 @@ jobs:
- name: no features
# don't test examples because they need collector feature
command: cargo test --no-default-features --features serenity/rustls_backend --lib --tests

# - name: all features + simdjson
# command: cargo test --all-features --features serenity/simdjson --lib --tests --examples
# rustflags: -C target-cpu=haswell # needed for simdjson
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
env:
RUSTFLAGS: -C target-cpu=haswell # for simd-json
RUSTDOCFLAGS: --cfg doc_nightly -D rustdoc::broken_intra_doc_links

# If on current/next branch (as opposed to PR or whatever), publish docs to github pages
- name: Move files
if: github.ref == 'refs/heads/current' || github.ref == 'refs/heads/next'
Expand Down
Loading

0 comments on commit 835a016

Please sign in to comment.