如何删除多个文本频道?

时间:2021-02-09 21:32:37

标签: python discord discord.py

@client.command(aliases=['d','dc'])
async def deletechannel(ctx,name: discord.TextChannel,amount):
    for i in range (int(amount)):
        channel = name
        await channel.delete()

它只让我一次删除一个,即使一个有 100 个同名频道

1 个答案:

答案 0 :(得分:0)

试试这个

先导入贪婪

from discord.ext.commands import Greedy

然后

@client.command(aliases=['d','dc'])
async def deleteChannel(ctx, name: Greedy[discord.TextChannel]):
for i in name:
await i.delete()

这里是关于贪婪的信息。 here