def in_channel(name):
"""
Checks if command is sent in a given channel ignores high roles.
To be used as a decorator
:param name: name of the channel
"""
def predicate(ctx):
if ctx.message.channel.is_private:
return False
# Adapted from discord.ext.core.has_any_role
user_roles = functools.partial(discordutils.get, ctx.message.author.roles)
if any(user_roles(name=role) is not None for role in ['Admin', 'Moderator', 'Support']):
return True
return ctx.message.channel.name == name
return commands.check(predicate)
评论列表
文章目录