My discord bot is not working properly

hello, I’m new here and actually I joined because I’ve been having problems with my discord bot that I write in python. I’m trying to make a function that deletes a channel on pre-specified server, then creates new one with the same overwrites. The problem is that bot deletes the chosen server, but doesn’t create a new one. Here is the code: (“server” is predefined)

if ((message.author.id=='myid')and(message.content.startswith('d!renew'))):
        lis=list(server.channels)
        chec=False
        for i in range(len(lis)):
            if lis[i].name==message.content[8:]:
                chan=lis[i]
                chec=True
                break
        if chec==False:
            await client.send_message('I can\'t find channel',message.channel)
            return
        Name=chan.name
        Overwrites=chan.overwrites
        await client.delete_channel(chan)
        await client.create_channel(server,Name,Overwrites)

I’d be very glad if I can find help on this forum :slight_smile:

Are any errors being thrown?

Yes, I can’t currently can’t paste exactly what it said, but apparently there’s a problem with passing overwrites down to create_channel()
it’s like it’s different type of variable than expected

So Channel.overwrites yields a list of tuples. The discordpy docs state that the Client.create_channel's overwrite is a list argument, however in all the API examples it would appear they are strictly feeding it tuples or variables referencing such. I would start by just printing the Overwrites variable once to visually inspect it and ensure it doesn’t have any weirdness to it. After that, maybe try unpacking the tuples from the list and feeding those in instead of the whole list object.