#My timeout command doesn't work (using timeout_for() method)

1 messages · Page 1 of 1 (latest)

hexed hill
#
duration = timedelta(days = days, hours = hours, minutes = minutes, seconds = seconds)
    if reason == None:
        await member.timeout_for(duration)
        await ctx.send(":white_check_mark: Operation Successful, <@{member.id}> was timeout for {days} day(s), {hours} hour(s), {minutes} minute(s), and {seconds} second(s).\nReason: {reason}\nAction taken by: <@{ctx.author.id}>")
    else:
        await member.timeout_for(duration, reason = reason)
        await ctx.send(":white_check_mark: Operation Successful, <@{member.id}> was timeout for {days} day(s), {hours} hour(s), {minutes} minute(s), and {seconds} second(s).\nReason: None\nAction taken by: <@{ctx.author.id}>")

I'm running into a TypeError (unsupported type for timedelta seconds component: NoneType) when the options (days, hours, minutes, seconds) are being taken as integer inputs. I mean, check this:

async def timeout(ctx, member: Option(discord.Member, description = 'Select a user to timeout'), reason: Option(str, description = 'Any reason?', required = False), days: Option(int, required = False), hours: Option(int, required = False), minutes: Option(int, required = False), seconds: Option(int, required = False)):

Could anyone help me? I tried everything that came to my head.

keen aspen
#

Else they will be NoneType

#

And that error will be caused

hexed hill
candid jackalBOT
#

Done with your help thread?

Please close your own help thread using </close:882631512829329448> (/close) with @open gorge.