示例#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,)
示例#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))
示例#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, )
示例#4
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Guides(bot))
示例#5
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(GuildSettings(bot))
示例#6
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Profile(bot))
示例#7
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Polls(bot))
示例#8
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Colors(bot))
示例#9
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(GlobalShop(bot))
示例#10
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Permissions(bot))
示例#11
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Messages(bot))
示例#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__()
示例#13
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Utility(bot))
示例#14
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Slash(bot))
示例#15
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Searches(bot))
示例#16
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Information(bot))
示例#17
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(TaskManagement(bot))
示例#18
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(WelcomeGoodbye(bot))
示例#19
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Moderation(bot))
示例#20
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Currency(bot))
示例#21
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(ErrorHandler(bot))
示例#22
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Quotes(bot))
示例#23
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Channels(bot))
示例#24
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Geolocation(bot))
示例#25
0
文件: xp.py 项目: AlaRubra123/Aoi
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(XP(bot))
示例#26
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(Triggers(bot))
示例#27
0
def setup(bot: aoi.AoiBot) -> None:
    bot.add_cog(ServerGambling(bot))
示例#28
0
def setup(bot: aoi.AoiBot) -> None:
    fun = Fun(bot)

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