I have looked for other answers on StackOverflow with no luck.
I have a mute command in discord.py, that looks like this:
@client.command() @commands.has_permissions(kick_members=True) async def mute(ctx, member: discord.Member, time: typing.Optional[str], *, reason = None): guild = ctx.guild for role in guild.roles: if role.name == "Muted": await member.add_roles(role) await ctx.send("{} has has been muted because {}!" .format(member.username + "#" + member.discriminator, reason)) How do I make the time argument into milliseconds? Similar to the ms module in node.js.
For example I want the duration of >mute @user 1h some reason to be parsed into 3600000 milliseconds.
1hor10m, meaning 1 hour and 10 minutes, respectively. I want to parse the given time into milliseconds.isnumericandisalpha. Is that enough of a start?