Beispiel #1
0
 async def predicate(ctx: Context) -> bool:
     if not hasattr(ctx, "character_data"):
         ctx.character_data = await ctx.bot.pool.fetchrow(
             'SELECT * FROM profile WHERE "user"=$1;', ctx.author.id)
     if ctx.character_data["god"]:
         return True
     raise NeedsGod()
Beispiel #2
0
 async def predicate(ctx: Context) -> bool:
     if not hasattr(ctx, "character_data"):
         ctx.character_data = await ctx.bot.pool.fetchrow(
             'SELECT * FROM profile WHERE "user"=$1;', ctx.author.id)
     if ctx.character_data["guildrank"] == "Leader":
         return True
     raise NoGuildPermissions()
Beispiel #3
0
 async def predicate(ctx: Context) -> bool:
     ctx.character_data = await ctx.bot.pool.fetchrow(
         'SELECT * FROM profile WHERE "user"=$1;', ctx.author.id
     )
     if ctx.character_data["guildrank"] != "Leader":
         return True
     raise NeedsNoGuildLeader()
Beispiel #4
0
 async def predicate(ctx: Context) -> bool:
     ctx.character_data = await ctx.bot.pool.fetchrow(
         'SELECT * FROM profile WHERE "user"=$1;', ctx.author.id
     )
     if ctx.character_data:
         return True
     raise NoCharacter()
Beispiel #5
0
 async def predicate(ctx: Context) -> bool:
     if not hasattr(ctx, "character_data"):
         ctx.character_data = await ctx.bot.cache.get_profile(ctx.author.id)
     classes = [
         c for i in ctx.character_data["class"]
         if (c := class_from_string(i))
     ]
Beispiel #6
0
 async def predicate(ctx: Context) -> bool:
     if not hasattr(ctx, "character_data"):
         ctx.character_data = await ctx.bot.cache.get_profile(ctx.author.id)
     if (ctx.character_data["guildrank"] == "Leader"
             or ctx.character_data["guildrank"] == "Officer"):
         return True
     raise NoGuildPermissions()
Beispiel #7
0
 async def predicate(ctx: Context) -> bool:
     if not hasattr(ctx, "character_data"):
         ctx.character_data = await ctx.bot.pool.fetchrow(
             'SELECT * FROM profile WHERE "user"=$1;', ctx.author.id)
     classes = [
         c for i in ctx.character_data["class"]
         if (c := class_from_string(i))
     ]
Beispiel #8
0
 async def predicate(ctx: Context) -> bool:
     if not hasattr(ctx, "character_data"):
         ctx.character_data = await ctx.bot.cache.get_profile(ctx.author.id)
     if (
         check := ctx.bot.in_class_line(ctx.character_data["class"], class_)
     ) and class_ == "Ranger":
         ctx.pet_data = await ctx.bot.pool.fetchrow(
             'SELECT * FROM pets WHERE "user"=$1;', ctx.author.id
         )
Beispiel #9
0
 async def predicate(ctx: Context) -> bool:
     async with ctx.bot.pool.acquire() as conn:
         if not hasattr(ctx, "character_data"):
             ctx.character_data = await conn.fetchrow(
                 'SELECT * FROM profile WHERE "user"=$1;', ctx.author.id)
         alliance = await conn.fetchval(
             'SELECT alliance FROM guild WHERE "id"=$1',
             ctx.character_data["guild"])
         owned_city = await conn.fetchval(
             'SELECT name FROM city WHERE "owner"=$1', alliance)
         if owned_city:
             raise CityOwned()
         return True
Beispiel #10
0
    async def predicate(ctx: Context) -> bool:

        async with ctx.bot.pool.acquire() as conn:
            if not hasattr(ctx, "character_data"):
                ctx.character_data = await conn.fetchrow(
                    'SELECT * FROM profile WHERE "user"=$1;', ctx.author.id)
            leading_guild = await conn.fetchval(
                'SELECT alliance FROM guild WHERE "id"=$1;',
                ctx.character_data["guild"])
        if (leading_guild == ctx.character_data["guild"]
                and ctx.character_data["guildrank"] == "Leader"):
            return True
        raise NoAlliancePermissions()
Beispiel #11
0
 async def predicate(ctx: Context) -> bool:
     async with ctx.bot.pool.acquire() as conn:
         if not hasattr(ctx, "character_data"):
             ctx.character_data = await ctx.bot.cache.get_profile(
                 ctx.author.id, conn=conn)
         alliance = await conn.fetchval(
             'SELECT alliance FROM guild WHERE "id"=$1',
             ctx.character_data["guild"])
         owned_city = await conn.fetchval(
             'SELECT name FROM city WHERE "owner"=$1', alliance)
         if not owned_city:
             raise NoCityOwned()
         ctx.city = owned_city
         return True
Beispiel #12
0
 async def predicate(ctx: Context) -> bool:
     if not hasattr(ctx, "character_data"):
         ctx.character_data = await ctx.bot.cache.get_profile(ctx.author.id)
     if ctx.character_data["god"]:
         return True
     raise NeedsGod()
Beispiel #13
0
 async def predicate(ctx: Context) -> bool:
     if not hasattr(ctx, "character_data"):
         ctx.character_data = await ctx.bot.cache.get_profile(ctx.author.id)
     if ctx.character_data["guildrank"] != "Leader":
         return True
     raise NeedsNoGuildLeader()
Beispiel #14
0
 async def predicate(ctx: Context) -> bool:
     ctx.character_data = await ctx.bot.cache.get_profile(ctx.author.id)
     if ctx.character_data:
         return True
     raise NoCharacter()