这在以前是可行的,但突然不起作用了.这段代码的要点是,它在服务器中通过every个文本通道并对其进行核爆(基本上是重新克隆并删除旧通道,同时将重新克隆的通道保留在那里).然而,它现在只适用于少数频道,然后停止说:
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10003): Unknown Channel
现在,我对不和还不熟悉.py.因此,如果有人能给我看一下修复代码,我真的很感激,并附上一个小的解释,让我知道我做错了什么.我try 自己修复它,将倾斜的频道添加到列表中,将其附加到该列表中,如果它看到该频道,则跳过它,但代码不起作用.下面是我的代码,如果有人向我展示了它的修复代码以及它是如何工作的,我将不胜感激:
@client.command()
async def reclone(ctx):
for channel in ctx.guild.text_channels:
time.sleep(0.2)
print(f"Cloning {channel.name}")
newchannel = await channel.clone(reason="Channel has been nuked")
print(f"Cloned {channel.name}")
await channel.delete()
print(f"Nuked {channel.name}")
time.sleep(0.2)
# Editing the position here
await newchannel.edit(position=channel.position)
print(f"Repositioned {newchannel.name}")
await newchannel.send("**[Soon]** :copyright:")
print(f"Sent message to {newchannel.name}")
我已经做了ctx.guild.text_channels
个,因为我只希望它删除服务器中的所有文本通道并重新克隆,其他什么都没有.