How do I change the channel permissions to specific roles in discord.py?
I've got this:
@commands.command()
async def change_perms(self, ctx, role):
ctx.channel.set_permissions(ctx.guild.role, send_messages=true)
but it no work
Seems like you're doing a few things wrong.
Use TextChannel.set_permissions:
@commands.command()
async def change_perms(self, ctx):
await ctx.channel.set_permissions(ctx.guild.default_role,send_messages=False)
That might work:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.