def _remove(self, ctx, rolename, user: discord.Member=None):
"""Removes a role from user, defaults to author
Role name must be in quotes if there are spaces.
You will need a 'Bot Commander' role in order to use this"""
server = ctx.message.server
author = ctx.message.author
role = self._role_from_string(server, rolename)
if role is None:
await self.bot.say("Role not found.")
return
if user is None:
user = author
if role in user.roles:
try:
await self.bot.send_typing(channel)
await self.bot.remove_roles(user, role)
await asyncio.sleep(1)
await self.bot.say("Role successfully removed.")
except discord.Forbidden:
await self.bot.send_typing(channel)
await asyncio.sleep(1)
await self.bot.say("I don't have permissions to manage roles!")
else:
await self.bot.send_typing(channel)
await asyncio.sleep(1)
await self.bot.say("User does not have that role.")
#@commands.group(pass_context=True, no_pm=True)
#@checks.mod_or_permissions()
#async def welcome(self, ctx)
#"""Shows your server's current welcome message or changes it. Bot Commander required"""
#server = ctx.message.server
#lm = load_messages()
#wlc = lm[server.id]['welcome'].format('user')
#await self.bot.say("**your server's current welcome message:** `{}`".format(wlc))
#@welcome.command(pass_context=True, no_pm=True)
#@checks.mod_or_permissions()
#async def onjoin(self, ctx, args)
#"""Sets the server's welcome message to when a new user joins the server"""
#server= ctx.message.server
#lm = load_messages()
评论列表
文章目录