【问题标题】:How to delete multiple text channel?如何删除多个文本通道?
【发布时间】:2021-05-13 14:02:31
【问题描述】:
@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 个同名频道

【问题讨论】:

    标签: python discord discord.py


    【解决方案1】:

    试试这个

    首先导入贪心

    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

    【讨论】:

      猜你喜欢
      • 2023-04-04
      • 2022-08-15
      • 1970-01-01
      • 1970-01-01
      • 2018-06-22
      • 1970-01-01
      • 2016-10-10
      • 1970-01-01
      • 2010-09-15
      相关资源
      最近更新 更多