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

ctx.guild.create_sticker yields 400 bad request when optional parameter description is not used. #1540

Closed
3 tasks done
kilgoreandy opened this issue Jul 31, 2022 · 0 comments · Fixed by #1546
Closed
3 tasks done
Labels
bug Something isn't working

Comments

@kilgoreandy
Copy link

kilgoreandy commented Jul 31, 2022

Summary

Pycord docs mention that parameter description is optional, however not using it in the parameters yields 400 bad request response.

Reproduction Steps

create a bot command using the ctx: commands.Context parameters

@bot.command(name="test", description="Admin only")
async def test(ctx: commands.Context):
    file = discord.File("userelo.png")
    await ctx.guild.create_sticker(name="dada", emoji="skull", file=file)
    await ctx.respond("created")

Once user invokes the command /test

Error log will show :

Ignoring exception in command test:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/commands/core.py", line 127, in wrapped
    ret = await coro(arg)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/commands/core.py", line 881, in _invoke
    await self.callback(ctx, **kwargs)
  File "/Users/andykilgore/PycharmProjects/CODStats/Bot.py", line 1770, in test
    await ctx.guild.create_sticker(name="dada", emoji="skull", file=file)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/guild.py", line 2476, in create_sticker
    data = await self._state.http.create_guild_sticker(self.id, payload, file, reason)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/http.py", line 360, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 0): The browser (or proxy) sent a request that this server could not understand.

Minimal Reproducible Code

@bot.command(name="test", description="Admin only")
async def test(ctx: commands.Context):
    file = discord.File("userelo.png")
    await ctx.guild.create_sticker(name="dada", emoji="skull", file=file)
    await ctx.respond("created")

Expected Results

Since description is an optional parameter in the docs,

  1. It should not be required when invoking the ctx.guild.create_sticker function. Not including description should not raise an error and should instead create the sticker.

OR

  1. docs should be updated to specify description is an required parameter.

Actual Results

If description is not included in the parameters, function responds with the following error message:

image

Intents

intents = discord.Intents.default() intents.members = True intents = discord.Intents().all()

System Information

Python : 3.9
Mac OS Ventura PB 1

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

await ctx.guild.create_sticker(name="dada", description="test", emoji="skull", file=file)

this works fine but like I stated, description should be optional according to https://docs.pycord.dev/en/master/api.html?highlight=sticker#discord.Guild.create_sticker

Thanks!

@kilgoreandy kilgoreandy added the unconfirmed bug A bug report that needs triaging label Jul 31, 2022
@Middledot Middledot added bug Something isn't working and removed unconfirmed bug A bug report that needs triaging labels Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants