예제 #1
0
def setup(bot: KoalaBot) -> None:
    """
    Load this cog to the KoalaBot.
    :param bot: the bot client for KoalaBot
    """
    bot.add_cog(BaseCog(bot))
    print("BaseCog is ready.")
예제 #2
0
def setup(bot: KoalaBot) -> None:
    """
    Load this cog to the KoalaBot.
    :param bot: the bot client for KoalaBot
    """
    bot.add_cog(Verification(bot))
    print("Verification is ready.")
예제 #3
0
def setup(bot: KoalaBot) -> None:
    """
    Load this cog to the KoalaBot.
    :param bot: the bot client for KoalaBot
    """
    bot.add_cog(Announce(bot))
    print("Announce is ready.")
예제 #4
0
def setup(bot: KoalaBot) -> None:
    """
    Loads this cog into the selected bot
    :param bot: The client of the KoalaBot
    """
    bot.add_cog(IntroCog(bot))
    print("IntroCog is ready.")
예제 #5
0
def setup(bot: KoalaBot) -> None:
    """
    Loads this cog into the selected bot

    :param  bot: The client of the KoalaBot
    """
    bot.add_cog(TextFilter(bot))
예제 #6
0
def setup(bot: KoalaBot) -> None:
    """
    Load this cog to the KoalaBot.
    :param bot: the bot client for KoalaBot
    """
    bot.add_cog(ColourRole(bot))
    print("ColourRole is ready.")
예제 #7
0
def setup(bot: KoalaBot) -> None:
    """
    Load this cog to the KoalaBot.
    :param bot: the bot client for KoalaBot
    """
    bot.add_cog(Info(bot))
    print("Info is ready")
예제 #8
0
def setup(bot: KoalaBot) -> None:
    """
    Load this cog to the KoalaBot.
    :param bot: the bot client for KoalaBot
    """
    if GMAIL_EMAIL is None or GMAIL_PASSWORD is None:
        print("Verification not started. API keys not found in environment.")
        KoalaBot.database_manager.insert_extension("Verify", 0, False, False)
    else:
        bot.add_cog(Verification(bot))
        print("Verification is ready.")
예제 #9
0
 async def predicate(ctx):
     cog = ctx.command.cog
     if KoalaBot.is_dm_channel(ctx):
         return False
     return ctx.author.id in cog.vote_manager.configuring_votes.keys(
     ) and cog.vote_manager.configuring_votes[
         ctx.author.id].guild == ctx.guild.id
예제 #10
0
def colour_is_enabled(ctx):
    """
    A command used to check if the guild has enabled twitch alert
    e.g. @commands.check(KoalaBot.is_admin)
    :param ctx: The context of the message
    :return: True if admin or test, False otherwise
    """
    try:
        result = KoalaBot.check_guild_has_ext(ctx, "ColourRole")
    except PermissionError:
        result = False

    return result or (str(ctx.author) == KoalaBot.TEST_USER and KoalaBot.is_dpytest)
예제 #11
0
def vote_is_enabled(ctx):
    """
    A command used to check if the guild has enabled verify
    e.g. @commands.check(vote_is_enabled)
    :param ctx: The context of the message
    :return: True if enabled or test, False otherwise
    """
    try:
        result = KoalaBot.check_guild_has_ext(ctx, "Vote")
    except PermissionError:
        result = False

    return result or (str(ctx.author) == KoalaBot.TEST_USER and KoalaBot.is_dpytest)
예제 #12
0
def test_test_user_is_owner(test_ctx):
    assert KoalaBot.is_owner(test_ctx)
예제 #13
0
def setup(bot: KoalaBot) -> None:
    """
    Load this cog to the KoalaBot.
    :param bot: the bot client for KoalaBot
    """
    bot.add_cog(LastCtxCog(bot))
예제 #14
0
def test_not_admin_is_admin(test_ctx):
    test_ctx.author = FakeAuthor(all_permissions=False)
    KoalaBot.is_dpytest = False
    assert not KoalaBot.is_admin(test_ctx)
    KoalaBot.is_dpytest = True
예제 #15
0
def test_admin_is_admin(test_ctx):
    test_ctx.author = FakeAuthor(name="TestUser#0002", all_permissions=True)
    assert KoalaBot.is_admin(test_ctx)
예제 #16
0
def test_invalid_test_user_is_admin(test_ctx):
    test_ctx.author = FakeAuthor(id=int(KoalaBot.BOT_OWNER) + 2)
    KoalaBot.is_dpytest = False
    assert not KoalaBot.is_admin(test_ctx)
    KoalaBot.is_dpytest = True
예제 #17
0
def test_test_user_is_admin(test_ctx):
    assert KoalaBot.is_admin(test_ctx)
예제 #18
0
def test_owner_is_owner(test_ctx):
    test_ctx.author = FakeAuthor(id=int(KoalaBot.BOT_OWNER))
    assert KoalaBot.is_owner(test_ctx)
예제 #19
0
 async def predicate(ctx):
     cog = ctx.command.cog
     if KoalaBot.is_dm_channel(ctx):
         return False
     return ctx.author.id in map(lambda x: x[0],
                                 cog.vote_manager.vote_lookup.keys())
예제 #20
0
def test_invalid_test_user_is_admin(test_ctx):
    test_ctx.author = FakeAuthor(name="TestUser#0002")
    assert not KoalaBot.is_admin(test_ctx)