Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I set "label" argument. But responce said it is not seted. #7305

Closed
3 tasks done
Marusoftware opened this issue Jul 30, 2021 · 1 comment
Closed
3 tasks done

I set "label" argument. But responce said it is not seted. #7305

Marusoftware opened this issue Jul 30, 2021 · 1 comment
Labels
invalid This is not right. unconfirmed bug A bug report that needs triaging

Comments

@Marusoftware
Copy link

Marusoftware commented Jul 30, 2021

Summary

Button in discord.py 2.0

Reproduction Steps

When create button 2+ times.

Minimal Reproducible Code

from discord import Button, ButtonStyle, View
from discord.ext.commands import Bot

bot=Bot()

@bot.command()
async def test(ctx):
    view=View()
    for i in range(10):
        view.add_item(button(label="test"+str(i), custom_id="test"))
    ctx.send("test",view=view)
    view=View()
    view.add_item(button(label="test final", custom_id="test"))
    ctx.send("test",view=view)

class button(Button):
    def __init__(self, label, custom_id):
        super().__init__(label=label, custom_id=custom_id, style=ButtonStyle.primary)
        self.label=label
        self.custom_id=custom_id
    async def callback(self, interaction):
        print(self.custom_id, self.label)

bot.run("token")

Expected Results

Ignoring exception in command start_vote:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/ext/commands/core.py", line 125, in wrapped
    ret = await coro(*args, **kwargs)
  (1 line is here. but I can't show you because of privacy)
  File "/usr/local/lib/python3.9/dist-packages/discord/abc.py", line 1413, in send
    data = await state.http.send_message(
  File "/usr/local/lib/python3.9/dist-packages/discord/http.py", line 337, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.1.label: This field is required

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/ext/commands/bot.py", line 960, in invoke
    await ctx.command.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/discord/ext/commands/core.py", line 825, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/usr/local/lib/python3.9/dist-packages/discord/ext/commands/core.py", line 134, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.0.components.1.label: This field is required

Actual Results

2+ times of sending, error is happun.

Intents

typing=False members=True

System Information

  • Python v3.9.2-final
  • discord.py v2.0.0-alpha
    • discord.py pkg_resources: v2.0.0a3407+gfc51736b
  • aiohttp v3.7.4.post0
  • system info: Linux 5.10.17-v7l+ Invalid syntax in library code? #1421 SMP Thu May 27 14:00:13 BST 2021

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

No response

@Marusoftware Marusoftware added the unconfirmed bug A bug report that needs triaging label Jul 30, 2021
@Spagetik
Copy link

image
You have to use discord.ui

@dpy-manager-bot dpy-manager-bot added the invalid This is not right. label Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This is not right. unconfirmed bug A bug report that needs triaging
Projects
None yet
Development

No branches or pull requests

2 participants