Exemplo n.º 1
0
def inactive_search(chat, message, args, sender):
    if len(args) > 0:
        chat.SendMessage("No arguments required.")
        return
    messages = chat.Messages
    chat_members = []
    for member in chat.Members:
        chat_members.append(member.Handle)
    active_members = []
    for message in messages:
        if message.Datetime < sub_months(datetime.datetime.now(), 2):
            continue
        handle = message.Sender.Handle
        if handle not in chat_members:
            continue
        if handle not in active_members:
            active_members.append(handle)
            print "Found active user {}".format(handle)
        if len(active_members) == len(chat_members):
            print "ALL users are active in the chat!"
            break
    print "Completed analysis of chat."
    print "Printing inactive members that have not posted in the last two months:"
    data = ''
    for user in chat_members:
        if user not in active_members:
            data += user + '\n'
    if data == '':
        chat.SendMessage("All users are active!")
        return
    else:
        url = post_gist(data)
        chat.SendMessage(url)
Exemplo n.º 2
0
def inactive_search(chat, message, args, sender):
    if len(args) > 0:
        chat.SendMessage("No arguments required.")
        return
    messages = chat.Messages
    chat_members = []
    for member in chat.Members:
        chat_members.append(member.Handle)
    active_members = []
    for message in messages:
        if message.Datetime < sub_months(datetime.datetime.now(), 2):
            continue
        handle = message.Sender.Handle
        if handle not in chat_members:
            continue
        if handle not in active_members:
            active_members.append(handle)
            print "Found active user {}".format(handle)
        if len(active_members) == len(chat_members):
            print "ALL users are active in the chat!"
            break
    print "Completed analysis of chat."
    print "Printing inactive members that have not posted in the last two months:"
    data = ''
    for user in chat_members:
        if user not in active_members:
            data += user + '\n'
    if data == '':
        chat.SendMessage("All users are active!")
        return
    else:
        url = post_gist(data)
        chat.SendMessage(url)
Exemplo n.º 3
0
def choose(chat, message, args, sender):
    helps = {}
    for cmd, desc in plugin.command_helps.items():
        helps.update({cmd: desc})

    message = "Commands:\n"
    for cmd, desc in helps.items():
        message += "* %s - %s\n" % (str(cmd), str(desc))
    url = post_gist(message)
    chat.SendMessage("Output: %s" % url)
Exemplo n.º 4
0
def inactive_search(chat, message, args, sender):
    if len(args) > 0:
        chat.SendMessage("No arguments required.")
        return
    messages = chat.Messages
    chat_length = len(messages)
    senders = {}
    for message in messages:
        handle = message.Sender.Handle
        if handle in senders:
            senders[handle] += 1
        else:
            senders[handle] = 1
    print "Completed analysis of chat."
    print "Writing statistics to file."
    data = ''
    for user, amount in senders.items():
        data += u'%s:%s:%s\n' % (user, amount, percentage(amount, chat_length))
    url = post_gist(data)
    chat.SendMessage("Analysis output: %s" % url)
Exemplo n.º 5
0
def inactive_search(chat, message, args, sender):
    if len(args) > 0:
        chat.SendMessage("No arguments required.")
        return
    messages = chat.Messages
    chat_length = len(messages)
    senders = {}
    for message in messages:
        handle = message.Sender.Handle
        if handle in senders:
            senders[handle] += 1
        else:
            senders[handle] = 1
    print "Completed analysis of chat."
    print "Writing statistics to file."
    data = ''
    for user, amount in senders.items():
        data += u'%s:%s:%s\n' % (user, amount, percentage(amount, chat_length))
    url = post_gist(data)
    chat.SendMessage("Analysis output: %s" % url)