微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何设置用户特定的频道权限 discord.py

如何解决如何设置用户特定的频道权限 discord.py

我正在尝试建立一个支持系统,让用户;support reason,然后创建一个带有权限的频道,供管理员和非管理员用户讨论和讨论帮助!这是我的代码


@command()
  async def support(self,ctx,*,reason = None):
    guildid = ctx.guild.id
    guild = ctx.guild
    user = ctx.author
    amount2 = 1
    await ctx.channel.purge(limit=amount2)
    channel = await guild.create_text_channel(f'Ticket {user}')
    await channel.set_permissions(ctx.guild.default_role,send_messages=False,read_messages=False)
    perms = channel.overwrites_for(user)
    await channel.set_permissions(user,view_channel=not perms.view_channel)
    await channel.set_permissions(user,read_message_history=not perms.read_message_history)
    await channel.set_permissions(user,send_messages=not perms.send_messages)
    await channel.send(f"{user.mention}")
    supem = discord.Embed(title=f"{user} requested support.",description= "",color=0x00ff00)
    supem.add_field(name="Reason",value=f"``{reason}``")
    supem.set_footer(text=f"Either an admin or support staff will be with you shortly...")
    await channel.send(embed=supem)

但我无法获得工作权限,我希望用户能够查看频道、发送消息和查看消息历史记录。请解释为什么我的权限设置部分不起作用。我没有收到任何错误,只是没有分配 view_channel 权限。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。