【发布时间】:2021-07-06 14:31:17
【问题描述】:
看,让我解释一下,假设我想允许用户在频道中发送消息,而他被拒绝发送消息。我想将他的权限设置为中立。但是,此代码允许用户发送消息。甚至他也有Muted 的角色。
@commands.command(hidden=False)
@commands.has_permissions(kick_members=True)
@commands.bot_has_permissions(manage_channels=True, manage_permissions=True)
async def unblock(self, ctx, member : discord.Member, *, reason:str=None):
"""To allow the blocked user to send messages that channel."""
guild = ctx.guild
if member.permissions_in(ctx.channel).send_messages == True: await ctx.send(f"{ctx.author.mention} {member.name} is already unblocked. They can send message")
else: await ctx.channel.set_permissions(member, send_messages=True, reason=f"Action requested by {ctx.author.name}({ctx.author.id}) || Reason: {reason}")
【问题讨论】:
标签: python discord discord.py