Eslyium 60a72b2ba4 [V3] Cleanup quotes in cogs (#1782)
* Cleanup quotes in cogs

* More quote cleanup that I missed

fixed a little bit of grammar here and there as well.

* [V3 Warnings] Change allowcustomreasons docstring

To help not confuse users who would believe that the command would use allow or disallow.

* Run black reformat
2018-06-07 00:42:59 -04:00

33 lines
1.0 KiB
Python

import discord
from discord.ext import commands
class MemberDefaultAuthor(commands.Converter):
async def convert(self, ctx: commands.Context, arg: str) -> discord.Member:
member_converter = commands.MemberConverter()
try:
member = await member_converter.convert(ctx, arg)
except commands.BadArgument:
if arg.strip() != "":
raise
else:
member = ctx.author
return member
class SelfRole(commands.Converter):
async def convert(self, ctx: commands.Context, arg: str) -> discord.Role:
admin = ctx.command.instance
if admin is None:
raise commands.BadArgument("Admin is not loaded.")
conf = admin.conf
selfroles = await conf.guild(ctx.guild).selfroles()
role_converter = commands.RoleConverter()
role = await role_converter.convert(ctx, arg)
if role.id not in selfroles:
raise commands.BadArgument("The provided role is not a valid selfrole.")
return role