Beispiel #1
0
def setup(bot: aoi.AoiBot) -> None:
    fun = Fun(bot)

    async def exec_customcmd(_, ctx: aoi.AoiContext, user: discord.Member):
        command = ctx.command.name
        await ctx.embed(
            title=random.choice(fun.custom_reactions[command].responses)
                .replace("{user}", ctx.author.display_name)  # noqa
                .replace("{target}", user.display_name),
            image=random.choice(fun.custom_reactions[command].images)
        )

    bot.add_cog(fun)

    with open("loaders/custreact.yaml") as fp:
        doc = YAML().load(fp)
        for key in doc:
            fun.custom_reactions[key] = CustomReaction(doc[key]["responses"], doc[key]["images"])

            cmd = commands.Command(
                name=key,
                func=exec_customcmd,
                brief=f"{key} custom command",
            )

            cmd.cog = fun

            fun.bot.add_command(cmd)

            fun.__cog_commands__ += (cmd,)
Beispiel #2
0
def setup(bot: aoi.AoiBot) -> None:
    if not bot.patreon_id or not bot.patreon_secret:
        bot.logger.warn("patreon:Not loading cog")
        bot.logger.warn(
            "patreon: both PATREON_ID and PATREON_CAMPAIGN must be present in .env"
        )
    bot.add_cog(Patreon(bot))
Beispiel #3
0
def setup(bot: aoi.AoiBot) -> None:
    fun = Roleplay(bot)

    bot.add_cog(fun)

    async def get_data(name) -> Tuple[RoleplayResponse, str]:
        async with aiohttp.ClientSession() as sess:
            async with sess.get(f"https://api.waifu.pics/sfw/{name}") as resp:
                return fun.roleplay_responses[name], (await resp.json())["url"]

    async def exec_multi_rp_command(self: Roleplay, ctx: aoi.AoiContext,
                                    user: discord.Member):
        resp, image = await get_data(ctx.command.name)
        await ctx.embed(description=random.choice(resp.phrases).format(
            f"**{ctx.author.display_name}**", f"**{user.display_name}**"),
                        image=image)

    async def exec_single_rp_command(self: Roleplay, ctx: aoi.AoiContext):
        resp, image = await get_data(ctx.command.name)
        await ctx.embed(description=random.choice(
            resp.phrases).format(f"**{ctx.author.display_name}**"),
                        image=image)

    with open("loaders/roleplay.yaml") as fp:
        doc = YAML().load(fp)
        for key in doc:
            if doc[key]["enabled"] == "no":
                continue

            fun.roleplay_responses[key] = RoleplayResponse(
                doc[key]["multi"] == "yes", doc[key]["phrases"])

            cmd = commands.Command(
                name=key,
                func=exec_multi_rp_command if fun.roleplay_responses[key].multi
                else exec_single_rp_command,
                brief=f"{key} someone" if fun.roleplay_responses[key].multi
                else f"{key} roleplay command",
                usage="@member" if fun.roleplay_responses[key].multi else None)

            cmd.cog = fun
            fun.bot.add_command(cmd)
            fun.__cog_commands__ += (cmd, )
Beispiel #4
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Guides(bot))
Beispiel #5
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(GuildSettings(bot))
Beispiel #6
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Profile(bot))
Beispiel #7
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Polls(bot))
Beispiel #8
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Colors(bot))
Beispiel #9
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(GlobalShop(bot))
Beispiel #10
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Permissions(bot))
Beispiel #11
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Messages(bot))
Beispiel #12
0
 def __init__(self, bot: aoi.AoiBot):
     self.bot = bot
     bot.slash = SlashCommand(bot, override_type=True, auto_delete=True, auto_register=True)
     self.bot.slash.get_cog_commands(self)
     bot.loop.create_task(self.register_commands())
     super(Slash, self).__init__()
Beispiel #13
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Utility(bot))
Beispiel #14
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Slash(bot))
Beispiel #15
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Searches(bot))
Beispiel #16
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Information(bot))
Beispiel #17
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(TaskManagement(bot))
Beispiel #18
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(WelcomeGoodbye(bot))
Beispiel #19
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Moderation(bot))
Beispiel #20
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Currency(bot))
Beispiel #21
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(ErrorHandler(bot))
Beispiel #22
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Quotes(bot))
Beispiel #23
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Channels(bot))
Beispiel #24
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Geolocation(bot))
Beispiel #25
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(XP(bot))
Beispiel #26
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Triggers(bot))
Beispiel #27
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(ServerGambling(bot))
Beispiel #28
0
def setup(bot: aoi.AoiBot) -> None:
    fun = Fun(bot)

    bot.add_cog(fun)
Beispiel #29
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Roles(bot))
Beispiel #30
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Weather(bot))