Exemplo n.º 1
0
    def _init():
        Config.load()

        Bot.session = vk_api.VkApi(token=Config.token)
        Bot.api = Bot.session.get_api()
        Bot.longpoll = LongPoll(Bot.session, Config.group_id)

        if Bot.api.groups.getOnlineStatus(
                group_id=Config.group_id)['status'] == 'none':
            Bot.api.groups.enableOnline(group_id=Config.group_id)

        db.load()
        db.set_yusup_id(Bot.api)
        schedule.every().day.at("10:30").do(run_threaded, job)
Exemplo n.º 2
0
        # todo load data dataDriver file.json or mongo

        # check if app running in docker environment and run server or client code
        if config.docker_mode:
            if os.environ.get("IS_SERVER"):
                # run server mode
                server = Server()
            else:
                # run client mode
                client = Client()
        exit(0)

    print("No arg detected :/")
    print("Please run 'python3 Toudoum.py run --help'")


if __name__ == '__main__':
    click.clear()
    console.banner()
    load_dotenv(".env")
    if os.environ.get("APP_VERSION") is None:
        print("Error no environments file found :/")
        exit(1)

    if os.getuid() == 0:  # todo patch here for check windows admin
        config = Config()
        config.load()
        cli()
    else:
        console.error("You need to be run this script with root privileges")
        exit(1)