在 Discord.py 中获取所有文本频道并更改权限
Get all text channels and change permissions in Discord.py
我希望能够将 send_messages
权限更改为关闭,以便能够锁定所有频道,例如“锁定”命令。
命令:await ctx.channel.set_permissions(ctx.guild.default_role,send_messages=False)
for channel in guild.channels:
if isinstance(channel, discord.TextChannel):
await channel.set_permissions(guild.default_role, send_messages=False)
试试这个 :D
我希望能够将 send_messages
权限更改为关闭,以便能够锁定所有频道,例如“锁定”命令。
命令:await ctx.channel.set_permissions(ctx.guild.default_role,send_messages=False)
for channel in guild.channels:
if isinstance(channel, discord.TextChannel):
await channel.set_permissions(guild.default_role, send_messages=False)
试试这个 :D