#Creating custom converter
1 messages · Page 1 of 1 (latest)
commands.Converter in general is basically incompatible with proper type-hinting, it's not supported in slash commands - you can provide a converter function like date: datetime = commands.Param(converter=str_to_datetime), or register one globally by doing something along these lines:
@commands.register_injection
def str_to_datetime(inter, date_input: str) -> datetime:
return ...
# then:
@commands.slash_command
async def my_cmd(inter, date: datetime):
...
how does it know it should match that specific function in the globally created ones? it checks return types?
yup, based on the return type annotation
oh okay then thanks 