I am using an Inline Converters in Discord.py, which is Greedy (It's Documentation, More Demo Code)
As you can see from those demo codes, It can also accept types like int, but when I use str, It raises this Error
TypeError: Greedy[str] is invalid
The command's code (By the way, it's a Cog command)
@commands.command()
async def temp(self, ctx:commands.Context, message:commands.Greedy[str]='None', user:discord.Member=None):
await ctx.send(f'{message = }, {user.mention}')
It's just a temporary command for now, but the Greedy[str] is not at all working, but it's working for int, discord.Member type values
And also I know about this too (The star parameter way)
async def function_name(self, ctx, *, arg)
I know it does the same, but It only works only if I want it to pass all the rest of the parameter values to one variable as string, But I don't want this one, I want to pass the parameter values in the middle like this
temp temporary text @user
Because I want to implement this method to many commands later
Is there anyway to make it work?
And I am using Python v3.8.12, and Discord.py v1.7.3 in Replit
Edit: I am currently using this code for now
@commands.command()
async def temp(self, ctx: commands.Context, *arg):
user_id = re.findall(r'(?<=<@)[!&]?(\d{17,22})(?=> *$)', arg[-1])
if len(user_id ) == 0:
raise TypeError('Command "temp" missing 1 required positional argument: "user"')
user = ctx.guild.get_member(int(user_id[0]))
message = ' '.join(arg[:-1])
await ctx.send(f'{message = }, {user.mention}')
It'll be helpful if you've found a way to use Greedy converter