pycord icon indicating copy to clipboard operation
pycord copied to clipboard

"Components" parameter for ".send" method

Open SkullCrusher0003 opened this issue 5 years ago • 3 comments

Summary

Add a components parameter for the send method

What is the feature request for?

The core library

The Problem

While discord.ui.View is pythonic, it often isn't the most convienient to use. That is why, as a backup / extra feature, add a components parameter to the send method. This will make sending components a bit more easy and convienient.

The Ideal Solution

Simply, add a "components" parameter to ".send" method

The Current Solution

No response

Additional Context

No response

SkullCrusher0003 avatar Sep 04 '21 15:09 SkullCrusher0003

The reason this was not the api for sending message components in the first place is because the view makes it easier for the developer. I don't find that it isn't convenient to use as well, adding a components kw/arg would serve to confuse, it is better to simply have 1 concrete way of doing something. Also this doesn't look very "convenient" to use

await something.send('Hello, world!', components=[
    ActionRow(
        Button(...)
    )
])

The discord.ui.button decorator makes it very easy to add buttons to a view. (For selects you should probably subclass because it looks ugly otherwise).

In my opinion, the view api is simpler to as you don't have to worry about the boring code that happens behind the scenes.

(Also if you really want to have a components arg you could check out this)

https://github.com/Pycord-Development/pycord/blob/8aa1e90d83bbb9ce482e4a83843ad2a337fc0741/discord/http.py#L413-L457

esmaycat avatar Sep 06 '21 08:09 esmaycat

On top of that, the interaction response is handled in the view.

Make a factory for yourself, that's what I'm doing.

siddhpant avatar Sep 09 '21 04:09 siddhpant

The reason this was not the api for sending message components in the first place is because the view makes it easier for the developer. I don't find that it isn't convenient to use as well, adding a components kw/arg would serve to confuse, it is better to simply have 1 concrete way of doing something. Also this doesn't look very "convenient" to use

await something.send('Hello, world!', components=[
    ActionRow(
        Button(...)
    )
])

The discord.ui.button decorator makes it very easy to add buttons to a view. (For selects you should probably subclass because it looks ugly otherwise).

In my opinion, the view api is simpler to as you don't have to worry about the boring code that happens behind the scenes.

(Also if you really want to have a components arg you could check out this)

https://github.com/Pycord-Development/pycord/blob/8aa1e90d83bbb9ce482e4a83843ad2a337fc0741/discord/http.py#L413-L457

I agree with this and will close this issue.

CodeWithSwastik avatar Sep 15 '21 13:09 CodeWithSwastik