Skip to content

[ext.bridge] Ephemeral kwarg causing errors in defer() and respond() #1449

Closed
@krishnans2006

Description

@krishnans2006

Summary

Using the ephemeral= keyword argument causes errors when it is passed into the prefix-command version of the bridge command.

Reproduction Steps

Using any ephemeral keyword arguments

Minimal Reproducible Code

    @bridge_command(name="commands", description="This page lists all commands")
    async def _commands(self, context: ApplicationContext) -> None:
        await context.defer(ephemeral=True)
        await context.respond("Commands List", ephemeral=True)

Expected Results

The ephemeral keyword argument should instead be ignored. This could be as simple as a:

if kwargs.get("ephemeral") is not None:
    del kwargs["ephemeral"]

This is in fact exactly what I added in both discord/message.py line 1625 and discord/ext/bridge/context.py line 153 to get it to work temporarily.

Actual Results

Ignoring exception in command commands:
Traceback (most recent call last):
  File "/home/krishnan/Coding/Hobby/ChessCord/ChessCordv2.0/venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 181, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/krishnan/Coding/Hobby/ChessCord/ChessCordv2.0/slash/help.py", line 38, in _commands
    await context.defer(ephemeral=True)
  File "/home/krishnan/Coding/Hobby/ChessCord/ChessCordv2.0/venv/lib/python3.10/site-packages/discord/ext/bridge/context.py", line 101, in defer
    return await self._defer(*args, **kwargs)
  File "/home/krishnan/Coding/Hobby/ChessCord/ChessCordv2.0/venv/lib/python3.10/site-packages/discord/ext/bridge/context.py", line 153, in _defer
    return await self._get_super("trigger_typing")(*args, **kwargs)
TypeError: Messageable.trigger_typing() got an unexpected keyword argument 'ephemeral'

and

Ignoring exception in command commands:
Traceback (most recent call last):
  File "/home/krishnan/Coding/Hobby/ChessCord/ChessCordv2.0/venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 181, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/krishnan/Coding/Hobby/ChessCord/ChessCordv2.0/slash/help.py", line 40, in _commands
    await context.respond(
  File "/home/krishnan/Coding/Hobby/ChessCord/ChessCordv2.0/venv/lib/python3.10/site-packages/discord/ext/bridge/context.py", line 81, in respond
    return await self._respond(*args, **kwargs)
  File "/home/krishnan/Coding/Hobby/ChessCord/ChessCordv2.0/venv/lib/python3.10/site-packages/discord/ext/bridge/context.py", line 147, in _respond
    message = await self._get_super("reply")(*args, **kwargs)
  File "/home/krishnan/Coding/Hobby/ChessCord/ChessCordv2.0/venv/lib/python3.10/site-packages/discord/ext/commands/context.py", line 399, in reply
    return await self.message.reply(content, **kwargs)
  File "/home/krishnan/Coding/Hobby/ChessCord/ChessCordv2.0/venv/lib/python3.10/site-packages/discord/message.py", line 1625, in reply
    return await self.channel.send(content, reference=self, **kwargs)
TypeError: Messageable.send() got an unexpected keyword argument 'ephemeral'

Intents

discord.Intents.all

System Information

  • Python v3.10.5-final
  • py-cord v2.0.0-candidate
    • py-cord pkg_resources: v2.0.0rc1
  • aiohttp v3.8.1
  • system info: Linux 5.15.48-1-MANJARO Update README.rst #1 SMP PREEMPT Thu Jun 16 12:33:56 UTC 2022

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

This can also apply to other slash-command-specific kwargs, which I can't specifically think of off the top of my head.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions