-
-
Notifications
You must be signed in to change notification settings - Fork 465
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
fix: attribute error in command serialization #2243
Merged
plun1331
merged 8 commits into
Pycord-Development:master
from
Mihitoko:fix_attribute_error_in_command_serialization
Dec 1, 2023
Merged
fix: attribute error in command serialization #2243
plun1331
merged 8 commits into
Pycord-Development:master
from
Mihitoko:fix_attribute_error_in_command_serialization
Dec 1, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This PR will close #2223 |
Mihitoko
changed the title
Fix attribute error in command serialization
fix: attribute error in command serialization
Oct 13, 2023
Closed
3 tasks
Dorukyum
previously requested changes
Nov 29, 2023
Signed-off-by: Dorukyum <[email protected]>
Sorry did not notice the comments, |
Dorukyum
added
bug
Something isn't working
priority: medium
Medium Priority
status: awaiting review
Awaiting review from a maintainer
labels
Nov 30, 2023
Signed-off-by: Dorukyum <[email protected]>
I've solved the merge conflict and will approve after testing. |
Thank you |
plun1331
previously approved these changes
Dec 1, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with following:
import typing
import discord
from discord.ext import commands
bot = commands.Bot()
@bot.slash_command(options=[discord.Option(int, name="my-option", description="This is my option!")])
async def my_command1(ctx: discord.ApplicationContext, my_option: int):
await ctx.respond("Hey, %d is my option!" % my_option)
@bot.slash_command()
async def my_command2(ctx: discord.ApplicationContext, my_option: discord.Option(int, name="my-option", description="This is my option!")):
await ctx.respond("Hey, %d is my option!" % my_option)
@bot.slash_command()
async def my_command3(ctx: discord.ApplicationContext, my_option: typing.Annotated[int, discord.Option(int, name="my-option", description="This is my option!")]):
await ctx.respond("Hey, %d is my option!" % my_option)
print(my_command1.to_dict())
print(my_command2.to_dict())
print(my_command3.to_dict())
Signed-off-by: plun1331 <[email protected]>
plun1331
approved these changes
Dec 1, 2023
Lulalaby
approved these changes
Dec 1, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
priority: medium
Medium Priority
status: awaiting review
Awaiting review from a maintainer
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When Serializing commands which have a
Annotated
annotation it comes to a AttributeError because the type information is not wrapped in SlashCommand type.Information
examples, ...).
Checklist
type: ignore
comments were used, a comment is also left explaining why.