谁有这方面的代码?
async def nuke(ctx, channel: discord.TextChannel = None):
if channel == None:
await ctx.send("You did not mention a channel!")
return
nuke_channel = discord.utils.get(ctx.guild.channels, name=channel.name)
if nuke_channel is not None:
new_channel = await nuke_channel.clone(reason="Has been Nuked!")
await nuke_channel.delete()
await new_channel.send("THIS CHANNEL HAS BEEN NUKED!")
await ctx.send("Nuked the Channel sucessfully!")
else:
await ctx.send(f"No channel named {channel.name} was found!")```
答案 0 :(得分:0)
您将不得不使用 discord.TextChannel.purge()
函数。
channel # discord.TextChannel object (most likely the argument)
await channel.purge(limit=100) # Purge a certain amount of messages. You can choose
查看 purge()
函数 docs