Skip to content

Conversation

@AstreaTSS
Copy link
Member

@AstreaTSS AstreaTSS commented May 11, 2023

Pull Request Type

  • Feature addition
  • Bugfix
  • Documentation update
  • Code refactor
  • Tests improvement
  • CI/CD pipeline enhancement
  • Other: [Replace with a description]

Description

Adds (back) hybrid slash commands, which makes it easy to make and use a prefixed command from a standard slash command. This is based off the old NAFF implementation, though improvements have been made where possible.

Changes

It's hybrid commands.

  • Add in a new extension to deal with hybrid commands.
    • Add in a manager for ease-of-injection.
    • Add in HybridSlashCommand and the command that transforms a slash command to a prefixed command.
    • Add in HybridContext for nice interop between the two types of commands.

Related Issues

Test Scenarios

import interactions
from interactions.ext import prefixed_commands as prefixed
from interactions.ext import hybrid_commands as hybrid

prefixed.setup(bot, generate_prefixes=generate_prefixes)
hybrid.setup(bot)

@hybrid.hybrid_slash_command()
@interactions.slash_option(
    "msg",
    "The message to send",
    opt_type=interactions.OptionType.INTEGER,
    required=False,
)
async def test(ctx: hybrid.HybridContext, msg: int | None = 1):
    await ctx.reply(str(msg * 5))

Python Compatibility

  • I've ensured my code works on Python 3.10.x
  • I've ensured my code works on Python 3.11.x

Checklist

  • I've run the pre-commit code linter over all edited files
  • I've tested my changes on supported Python versions
  • I've added tests for my code, if applicable
  • I've updated / added documentation, where applicable

@AstreaTSS AstreaTSS force-pushed the hybrid-commands-v2 branch 2 times, most recently from 77601ab to d00e97d Compare May 25, 2023 02:17
@AstreaTSS AstreaTSS marked this pull request as ready for review May 25, 2023 02:38
@AstreaTSS
Copy link
Member Author

Ready for testing. Do note the extent of these changes - as with the original hybrid command PR from a while back, testing everything is impossible and there's likely plenty of bugs right now.

@AstreaTSS AstreaTSS force-pushed the hybrid-commands-v2 branch from 589a9e2 to 3529881 Compare June 4, 2023 06:59
Copy link
Member Author

@AstreaTSS AstreaTSS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumping. Two developers from the Discord server have said it's stable for them - I think this is safe to merge.

@AstreaTSS AstreaTSS force-pushed the hybrid-commands-v2 branch from 2f34bc3 to 5603008 Compare June 29, 2023 16:57
@AstreaTSS
Copy link
Member Author

Rebased! Also did a tiny adjustment to the title of the hybrid command section to note how prefixed commands are often called text commands.

@i0bs i0bs merged commit 1d5a99f into interactions-py:unstable Jul 5, 2023
@AstreaTSS AstreaTSS deleted the hybrid-commands-v2 branch July 13, 2023 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants