Summary
ColourConverter.convert returns a tuple upon receiving the string holographic_style (or "holographic style")
Reproduction Steps
- Create a prefix command with a parameter annotated with
commands.Color.
- Run the bot.
- Run the command, passing it
holographic_style as an argument.
- Boom, the converter returns a tuple rather than
commands.Color (or failing)
Minimal Reproducible Code
import os
import disnake
from disnake.ext import commands
intents = disnake.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix=",", intents=intents)
@bot.command()
async def woo(ctx: commands.Context, color: disnake.Color) -> None:
await ctx.send(str(color))
bot.run(os.getenv("BOT_TOKEN"))
Expected Results
The converter should fail with an exception
Actual Results
The converter returns a tuple of 3 Colors, while it's annotated as returning a Color
Intents
.default() + message_content
System Information
- Python v3.10.18-final
- disnake v2.11.0-alpha
- disnake importlib.metadata: v2.12.0a4863+g3aa64412
- aiohttp v3.12.15
- system info: Windows 10 10.0.26100 AMD64
Checklist
Additional Context
Bad code!
|
arg = arg.replace(" ", "_") |
|
method = getattr(disnake.Colour, arg, None) |
|
if arg.startswith("from_") or method is None or not inspect.ismethod(method): |
|
raise BadColourArgument(arg) |
|
return method() |
Summary
ColourConverter.convertreturns a tuple upon receiving the stringholographic_style(or"holographic style")Reproduction Steps
commands.Color.holographic_styleas an argument.commands.Color(or failing)Minimal Reproducible Code
Expected Results
The converter should fail with an exception
Actual Results
The converter returns a tuple of 3
Colors, while it's annotated as returning aColorIntents
.default()+message_contentSystem Information
Checklist
Additional Context
Bad code!
disnake/disnake/ext/commands/converter.py
Lines 753 to 757 in 9ebc9de