Skip to content

Conversation

@Middledot
Copy link
Member

@Middledot Middledot commented Jul 12, 2022

Summary

Makes a bunch of changes to ext.bridge

  • Implements bridge command groups
    • bridge.map_to decorator to use main command as subcommand
  • Attachment option
  • is_app property added to better differentiate context types

Information

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting, examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.

Middledot and others added 8 commits July 11, 2022 22:33
* Bridge Groups
* `is_app` attribute to better differentiate contexts
* Simplify bridge classes and such
- feels a bit hacky so might revise later?
- also *maybe* allow *.discordapp.net urls to be transformed into attachments?
@Middledot Middledot added bug Something isn't working feature Implements a feature Merge with squash labels Jul 12, 2022
@Middledot Middledot marked this pull request as ready for review July 13, 2022 01:42
Lulalaby
Lulalaby previously approved these changes Jul 13, 2022
@Lulalaby
Copy link
Member

@Dorukyum

* turn property to simple attribute

* doc rewording

* rm extra parentheses

Co-Authored-By: Dorukyum <53639936+Dorukyum@users.noreply.github.com>
@Dorukyum
Copy link
Member

Dorukyum commented Aug 2, 2022

Could we add an example?

@Dorukyum
Copy link
Member

Dorukyum commented Aug 2, 2022

I get the following error on startup now:

Traceback (most recent call last):
  File "test.py", line 9, in <module>
    async def hello(ctx: bridge.BridgeContext):
  File "discord/ext/bridge/bot.py", line 88, in decorator
    result = bridge_group(**kwargs)(func)
  File "discord/ext/bridge/core.py", line 318, in decorator
    return BridgeCommandGroup(callback, **kwargs)
  File "discord/ext/bridge/core.py", line 262, in __init__
    self.slash_variant: BridgeSlashGroup = BridgeSlashGroup(self.ext_variant.name, *args, **kwargs)
  File "discord/ext/bridge/core.py", line 64, in __init__
    super().__init__(func, **kwargs)
  File "discord/commands/core.py", line 625, in __init__
    raise TypeError("Callback must be a coroutine.")
TypeError: Callback must be a coroutine.

The code I used:

bot = bridge.Bot(command_prefix="t.", intents=Intents.all())

@bot.bridge_group(description="Test command")
async def hello(ctx: bridge.BridgeContext):
    ...

@hello.command()
async def there(ctx: bridge.BridgeContext, attachment: Attachment):
    await ctx.respond(attachment.filename)

@Lulalaby Lulalaby disabled auto-merge August 2, 2022 10:46
"temporary fix" until I make a pr to fix this library-wide (slash command groups register without subcommands???) because it would be "out of scope"
@Middledot Middledot enabled auto-merge (squash) August 2, 2022 15:36
subcommands of ext commands don't have the custom transform method to deal with attachment options.
Copy link
Member Author

@Middledot Middledot left a comment

Choose a reason for hiding this comment

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

Should be fixed and an example was added.

@Middledot Middledot disabled auto-merge August 5, 2022 15:01
@Middledot Middledot enabled auto-merge (squash) August 5, 2022 15:03
@Middledot Middledot added the ext.bridge Relating to ext.bridge label Aug 5, 2022
@Middledot Middledot removed the bug Something isn't working label Aug 9, 2022
Copy link
Member

@Dorukyum Dorukyum left a comment

Choose a reason for hiding this comment

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

Hopefully the last review for this pr 😅

@Lulalaby Lulalaby disabled auto-merge August 13, 2022 00:29
@Lulalaby Lulalaby enabled auto-merge (squash) August 13, 2022 00:30
Copy link
Member

@Dorukyum Dorukyum left a comment

Choose a reason for hiding this comment

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

Good job

@Lulalaby Lulalaby merged commit 369e44d into Pycord-Development:master Aug 13, 2022
@Middledot Middledot deleted the ext-bridge-rewrite branch August 13, 2022 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext.bridge Relating to ext.bridge feature Implements a feature status: awaiting review Awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants