Exemplo n.º 1
0
def main():
    # Create the parser
    my_parser = argparse.ArgumentParser(
        prog="Latte",
        description="Latte Bot`s advanced CLI options parser.",
        usage=f"%(prog)s [options]")

    my_parser.add_argument(
        "--test",
        "-t",
        dest="test",
        type=cast_to_bool,
        help=
        "Boolean value which indicates if the bot is starting as test mode.",
        required=True)

    args: argparse.Namespace = my_parser.parse_args()
    print(f"Caught CLI arguments : {args}")

    bot = Latte(test_mode=args.test,
                description="카페라테를 좋아하는 개발자가 만든 디스코드 봇이에요!",
                help_command=None)

    bot.run()

    if bot.check_reboot():
        import sys, os
        excutable = sys.executable
        sys_args = sys.argv[:]
        print(f"System arguments : {sys_args}")
        args.insert(0, excutable)
        print(f"Executing cmd command with arguments ` {sys_args} `")
        os.execv(sys.executable, sys_args)
Exemplo n.º 2
0
def setup(bot: Latte):
    cog = BotInfoCog(bot)
    bot.get_logger().info(
        msg="[BotInfoExt] Injecting key from ext_map matching with module path into cog ..."
            "(To access to cog instance in easier way.)"
    )
    cog.__cog_name__ = get_cog_name_in_ext(ext_map=bot.ext.ext_map, module_path=BotInfoCog.__module__)
    bot.add_cog(cog)
Exemplo n.º 3
0
    def __init__(self, bot: Latte):
        super().__init__(bot=bot)

        if not hasattr(bot, 'lavalink') or self.bot.lavalink is None:
            # This ensures the client isn't overwritten during cog reloads.
            bot.lavalink = lavalink.Client(
                user_id=self.bot.user.id if self.bot.
                user is not None else self.bot.bot_config["id"])
            bot.lavalink.add_node(
                bot.bot_config["lavalink"]["host"],  # Host
                bot.bot_config["lavalink"]["port"],  # Port
                bot.bot_config["lavalink"]["password"],  # Password
                bot.bot_config["lavalink"]["region"]  # Region
            )
            bot.add_listener(bot.lavalink.voice_update_handler,
                             "on_socket_response")
        bot.lavalink.add_event_hook(self.track_hook)
Exemplo n.º 4
0
def setup(bot: Latte):
    print(f"[Latte] Registering the cog `Alarm`")
    bot.add_cog(cog=Alarm(bot=bot))
Exemplo n.º 5
0
def setup(bot: Latte):
    bot.add_cog(Info(bot=bot))