예제 #1
0
 def message_matches(self, matches):
     for match in matches:
         match_id = match["_id"]
         features.pause()
         message = "Good evening...."
         tinder_api.send_msg(match_id, message)
         print("Messaged " + match["name"] + ": " + message)
예제 #2
0
def send_messages(fb_user_data, late_time):
    tinder_api.authverif(fb_user_data['fb_access'], fb_user_data['fb_user'])
    matches = tinder_api.get_updates()['matches']
    for match in matches[:10]:
        tinder_api.send_msg(
            match, u"""Hey babe, just letting you know I’m the
        kind of person who turns up to things {}
        minutes late. Hope you’re okay with that 😉""".format(late_time /
                                                                  60))
        pause()
예제 #3
0
 def onMatch(self, match):
     ## onMatch will be called always if its the first iteration, so we update self.match before check if is new match
     girl = match['person']
     bio = girl['bio'] if 'bio' in girl else ''
     self.matches[match['_id']] = {
         'name':
         girl['name'],
         'age':
         get_girls_age(datetime.now(), girl['birth_date']),
         'messages': {
             message_obj['message']: i
             for i, message_obj in enumerate(match['messages'])
         },
         'photos': [
             photo_obj['processedFiles'][0]['url']
             for photo_obj in girl['photos']
         ],  # get url for each photo of the girl
         'bio':
         bio
     }
     if self.isNewMatch(match['_id']):  ## New match!!
         self.statistics['total_matches'] += 1
         self.statistics['match_rate'] = self.statistics[
             'total_matches'] / self.statistics[
                 'swipes'] if self.statistics['swipes'] != 0 else 0
         self.update_statistics_file()
         f = open('match_ids.txt', 'a')
         f.write(str(match['_id']) + '\n')
         f.close()  # updates ids file
         self.current_matches.append(str(match['_id']))
         girl = self.matches[match['_id']]
         self.emailer.connect()  # Email Lucas about new match
         self.emailer.make_email(girl, 'match')
         self.emailer.send_email()
         self.emailer.disconnect()
         print('NEW MATCH')
         while not self.isLucasOn():
             time.sleep(10)
         try:
             url = config.aws_host + "/match"
             json_data = {"name": girl['name'], "age": str(girl['age'])}
             r = requests.post(url, json=json_data)
             response = r.json()
         except Exception as e:
             print(e)
             return {
                 "error":
                 "Something went wrong when trying to communicate with Lucas."
             }
         if bool(int(response["will_unmatch"])):  # unmatch person
             match_id = match['_id']
             self.current_matches.remove(match_id)
             self.fix_id_file()
             del self.matches[match_id]
             return tinder_api.unmatch(match_id)
         else:
             return tinder_api.send_msg(match['_id'], response['message'])
예제 #4
0
def forward_messages():
    #get all the tinder data
    tinder_matches, tinder_messages = get_matches_and_messages()

    #read the existing pairs from our file to figure out what is new
    paired_users = get_paired_users()  # { person_idA : person_idB }
    unpaired_users = [id for id in tinder_matches if id not in paired_users]
    ghosted_users = [id for id in paired_users if id not in tinder_matches]

    #read the existing sent messages from our file and figure out what needs to be sent
    sent_messages = get_sent_messages()  # [ message_id ]
    unsent_messages = [id for id in tinder_messages if id not in sent_messages]

    #send the unsent messages to their pair
    unsendable = 0
    while len(unsent_messages) > unsendable:
        message_id = unsent_messages.pop(0)
        message = tinder_messages[message_id]
        message_from = message["from"]
        message_text = message["message"]
        if message_from == "59c0946bd134935f459928e6":
            #ignore, it is our own message.
            continue
        if message_from not in paired_users:
            #This user is not paired with anyone yet
            unsent_messages.append(message_id)
            unsendable += 1
            continue
        message_to = paired_users[message_from]
        if message_to not in tinder_matches:
            #No longer matched with this pair
            unsent_messages.append(message_id)
            unsendable += 1
            continue
        to_match_id = tinder_matches[message_to]

        result = api.send_msg(to_match_id, message_text)
        print("Send {} to {}".format(message_text, to_match_id),
              file=open("/home/aaron/Desktop/Tinder/messagelog.txt", "a"))
        dumps(result, "Send message to {}".format(to_match_id))
        if "error" not in result:
            sent_messages.append(message_id)
        else:
            #api call failed?
            unsent_messages.append(message_id)
            unsendable += 1
            continue

    #save the newly sent messages
    save_sent_messages(sent_messages)

    #dump to output so we can see if it is working right
    #dumps(tinder_messages, "Tinder messages:")
    dumps(unpaired_users, "Unpaired users:")
    dumps(ghosted_users, "Ghosted users:")
    dumps(unsent_messages, "Unsent messages:")
예제 #5
0
def start_conversations():
    tinder_matches, tinder_messages = get_matches_and_messages()
    paired_users = get_paired_users()  # { person_idA : person_idB }

    users_with_messages = list({
        tinder_messages[id]["from"]
        for id in tinder_messages
    }) + list({tinder_messages[id]["to"]
               for id in tinder_messages})  #TODO from | to
    no_chat_users = [
        id for id in tinder_matches if id not in users_with_messages
    ]

    #we only want to send a message to one of the two pairs
    users_to_start = []
    for id in no_chat_users:
        pair = paired_users[id]
        if pair not in users_to_start:
            users_to_start.append(id)

    dumps(paired_users, "Paired users")
    dumps(no_chat_users, "No chat users")
    dumps(users_to_start, "Users to start")

    greetings = [
        "Hey!", "Hello!! :)", "Yo!", "Sup?", "G'day!", "Hiya!", "Hey hey"
    ]

    for id in users_to_start:
        greeting = random.choice(greetings)
        send_to = tinder_matches[id]
        print("Send {} to {}".format(greeting, send_to),
              file=open("/home/aaron/Desktop/Tinder/messagelog.txt", "a"))
        result = api.send_msg(send_to, greeting)
        if "error" in result:
            print("Could not send message to {} @ {}".format(id, send_to))
예제 #6
0
 def onNewMessage(self, new_messages, match_id):
     her_messages = get_her_messages(self.matches[match_id]['name'],
                                     new_messages)
     my_messages = get_my_messages(self.matches[match_id]['name'],
                                   new_messages)
     did_she_text_last = (her_messages[-1] == new_messages[-1]) if (
         len(her_messages) != 0) else False
     if 'WRONG HOLE' in her_messages or 'WIERD' in her_messages:  # unmatch person
         print('ARE YOU HERE FOR REAL?')
         self.current_matches.remove(match_id)
         self.fix_id_file()
         del self.matches[match_id]
         return tinder_api.unmatch(match_id)
     if 'MORE' == her_messages[-1]:
         tinder_api.send_msg(
             match_id, create_message(self.matches[match_id]['name'],
                                      "more"))
         print("MORE MESSAGE SENT")
     if did_she_text_last and AUTOMATIC_MESSAGES['YES DADDY'].rstrip(
             '\n\r'
     ) not in my_messages:  # This means that I am talking to her now
         if 'YES DADDY' in her_messages or 'LETS GO' in her_messages:
             tinder_api.send_msg(
                 match_id,
                 create_message(self.matches[match_id]['name'],
                                "YES DADDY"))
             print("NEW DATE FOUND -- YES DADDY MESSAGE SENT")
             self.emailer.connect()  # Tell Lucas about new date
             girl = self.matches[match_id]
             self.emailer.make_email(girl, 'date')
             self.emailer.send_email()
             self.emailer.disconnect()
         else:
             tinder_api.send_msg(
                 match_id,
                 create_message(self.matches[match_id]['name'],
                                "invalid_reply"))
             print("INVALID REPLY MESSAGE SENT")
예제 #7
0
파일: test.py 프로젝트: ultralytics/tinder
            img_name = txt_file[:-4].split('/')[-1]
            box = labels[0].astype('int')
            h, w = box[3] - box[1], box[2] - box[0]
            area = w * h

            if (w > 150) and (h > 150) and (area > 30e3):
                img = cv2.imread(match_dir + img_name)
                cv2.imwrite(crop_dir + img_name, img[box[1]:box[3],
                                                     box[0]:box[2]])

exit()

# Get Tinder Recommendations of people around you
# recommendations = tinder_api.get_recommendations()
recommendations = tinder_api.get_recs_v2()

# select one recommended individual
testid = recommendations['data']['results'][0]['user']['_id']
print(testid)

# Retrieve profile from id
testperson = tinder_api.get_person(testid)
testperson

# Like a user
# tinder_api.like('5a10ae3c8802dc4401463712')

# message a match
tinder_api.send_msg('59ff7c30117d37c0572338d55a10ae3c8802dc4401463712',
                    'Hi, boy! Gloria Tinder-Robot here')
예제 #8
0


get_my_locations('locations.csv') # получаем 3 случайных локации из файла и записываем в список my_locations
for location in my_locations:
    try:
        lat = location.split(":")[0]
        lon = location.split(":")[1]
        api.get_ping(lat,lon)
        matches = get_match_info()
        for match in matches:
            try:
                match_id = matches[i]['match_id']
                offer_id = 1
                text = select_msg(match_id,offer_id)
                api.send_msg(match_id, text)
            except:
                continue
        rec = api.get_recommendations()
        i = 0
        for user in rec:
            try:
                if i%3=0:
                    api.dislike(user["person_id"])
                else:
                    api.like(user["person_id"])
                i ++
            except:
                continue
    except:
        break