我一直在尝试使用这个功能,但没有掌握它的窍门。这是我试过的东西
# lockdown
@client.command()
@commands.has_permissions(administrator=True)
async def lockdown(ctx, channel: discord.TextChannel=None):
channel = channel or ctx.channel
await ctx.send("This channel has been locked. You will need to change the settings to revert this action.")
if ctx.guild.default_role not in channel.overwrites:
overwrites = {
ctx.guild.default_role: discord.PermmisionOverwrite(send_messages=False)
}
await channel.edit(overwrites=overwrites)
但它似乎不起作用,我知道为什么。我不知道如何正确使用这个函数。看到API文档,我甚至感到困惑。我能举个好例子吗
你把不和谐放在哪里,你写错了。您可以改为放置discord.PermissionOverwrite
相关问题 更多 >
编程相关推荐