'Object of type TextChannel is not JSON serializable' 尝试创建频道时

'Object of type TextChannel is not JSON serializable' when trying to create a channel

我正在尝试做到这一点,如果某个频道被删除,它会在一个小时后重新制作。但是当我使用这段代码时:

async def on_guild_channel_delete(channel): 
            guild = channel.guild                   
      await guild.create_text_channel(channel)

它returns:Object of type TextChannel is not JSON serializable

有办法解决这个问题吗?

Get the channels namestr:

await guild.create_text_channel(str(channel))