disnake icon indicating copy to clipboard operation
disnake copied to clipboard

connectors doesn't seem to do anything

Open onerandomusername opened this issue 2 months ago • 5 comments

Summary

title

Reproduction Steps

set connectors on an app command constructor

Minimal Reproducible Code


Expected Results

should map that option name to that variable name locally

Actual Results

it doesn't

Intents

0

System Information

irrelevant

Checklist

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

Additional Context

No response

onerandomusername avatar Oct 07 '25 20:10 onerandomusername

This is intended, and mentioned in the @slash_command parameter description (this could be improved, though); it's meant to be used in conjunction with options, i.e. only works when completely opting out of the automatic signature parsing.

For instance, you could pass options= with an option named "a", and then have connectors={"a": "b"} to make a (inter, b: str) -> Any command callback work.

Specifying just connectors is basically a no-op, as it doesn't affect command registration. The command still gets registered with the name from the signature, and the connectors mapping then has no effect. Both this and options have always seemed a little out-of-place in the @slash_command decorator to me, tbqh.

tl;dr, this is arguably a documentation issue

shiftinv avatar Oct 07 '25 20:10 shiftinv

In some cases it is nice to use all of the regular parsing, but have an option with a name that's not allowed in python, eg an option name including a -.

onerandomusername avatar Oct 07 '25 21:10 onerandomusername

some_name = Param(name="some-name") should work, in that case?

shiftinv avatar Oct 07 '25 21:10 shiftinv

some_name = Param(name="some-name") should work, in that case?

This is unfortunately not very type-safe, as now I'm providing a default which is always present when using the method: disnake doesn't do any replacement to remove that default from the variable.

If we support typing.Annotated, I could use that.

onerandomusername avatar Oct 08 '25 11:10 onerandomusername

If we support typing.Annotated, I could use that.

On it

Enegg avatar Oct 15 '25 12:10 Enegg