def convert(cls, ctx, arg):
lowered = arg.lower()
with contextlib.suppress(KeyError):
return cls._default_categories[lowered]
query = ctx.session.select.from_(cls).where((cls.guild_id == ctx.guild.id)
& (cls.name == lowered))
result = await query.first()
if result is None:
raise commands.BadArgument(f"Category {lowered} doesn't exist... :(")
return result
评论列表
文章目录