Exemplo n.º 1
0
        Moves 1 month at a time to account for newly added users.
    '''
    current = int(time.time()) * 1000
    for i in range(9):
        updateActiveIds(current)
        current -= 2592000000 # go back a month

def idsToNames(idDict):
    '''
    Convert a dictionary of user information to a list of names
    '''
    nameList = []
    for id in idDict:
        user = idDict[id]
        nameList.append(user.name)
    nameList.sort()

    return nameList


if __name__ == '__main__':
    updateWithTimestamps()

    totalParticipants = set(client.fetchGroupInfo(gcID)[gcID].participants)
    inactiveIDs = client.fetchUserInfo(*totalParticipants.difference(activeIDs))

    nameList = idsToNames(inactiveIDs)
    print(len(nameList), "people have not checked the chat in the last 9 months")
    print(nameList)
    client.logout()
Exemplo n.º 2
0
    except FBchatException:
        print("Failed to log into {}".format(username))
    except:
        print("There has been an error with the client login system... \n"
              "Check fbchat/_state.py line 190, replace with \"revision = 1\"")
        exit(1)
    else:
        print("Login successful!")
        break

# get list of user IDs from group thread
while True:
    try:
        groupID = input("Group ID > ").rstrip()
        print("group: {}".format(groupID))
        inputGroup = client.fetchGroupInfo(groupID).get(groupID)

    except FBchatException:
        print("Could not find a group with this ID...")
    # except:
    #   print("There has been an error collecting the group info...")
    else:
        print("\nGroup \"{}\" found!".format(inputGroup.name))
        if selectMode:
            confirmation = input("Select from users in this group? [Y/n] > ")
        else:
            confirmation = input(
                "Send messages to all other users in this group? [Y/n] > ")
        if confirmation.lower()[0] == 'y':
            break
Exemplo n.º 3
0
from fbchat.models import *

from datetime import datetime
from threading import Timer

from getpass import getpass
from sys import argv

p = ""
try:
    p = argv[1]
except:
    p = getpass()

client = Client('*****@*****.**', p)
group = client.fetchGroupInfo('2136630926368530')
client.logout()
user_ids = group['2136630926368530'].participants

x = datetime.today()
try:
    y = x.replace(day=x.day + 1, hour=0, minute=0, second=0, microsecond=0)
except ValueError:
    y = x.replace(month=x.month + 1,
                  day=1,
                  hour=0,
                  minute=0,
                  second=0,
                  microsecond=0)
delta_t = y - x
Exemplo n.º 4
0
from fbchat.models import *

from datetime import datetime
from threading import Timer

from getpass import getpass
from sys import argv

p = ""
try:
    p = argv[1]
except:
    p = getpass()

client = Client('*****@*****.**', p)
group = client.fetchGroupInfo('339661942891632')
client.logout()
user_ids = group['339661942891632'].participants

x = datetime.today()
try:
    y = x.replace(day=x.day + 1, hour=0, minute=0, second=0, microsecond=0)
except ValueError:
    y = x.replace(month=x.month + 1,
                  day=1,
                  hour=0,
                  minute=0,
                  second=0,
                  microsecond=0)
delta_t = y - x