コード例 #1
0
    if pp:
        print("    Twitter Campaigns CLI v0.1")
        print("    ==========================")
        print()

    if command == "add":
        # add command
        pp and print("[+] Authenticating.....", end='')
        me = chakraInstance.get_me()
        user_id = me["id"]
        print("Authenticated as", me["name"])

        print("[+] Making a new campaign with name `{}` and id `{}`".format(
            arguments.name, arguments.id))

        if (campaign.id_exists(arguments.id)):
            pp and print("[!] Campaign with same ID already exists")
            pp and print("[!] Failure")
            exit(1)

        # TODO: Check if same id exists

        if arguments.strategy_type == STRATEGY_TWEETS:
            pp and print("[+] Strategy set to 'User with most retweets first'")
            pp and print("[+] Fetching followers.....", end='')
            followers = chakraInstance.get_ranks_from_retweets(user_id)
            pp and print("fetched {} followers".format(len(followers)))
            campaign.create_new_campaign(arguments.id, arguments.name,
                                         arguments.strategy_type, followers,
                                         False, arguments.message)
            pp and print("[+] Success")