ee04134a by Barry

Full database integration. No more json!

1 parent 6c38afa3
No preview for this file type
import json
import sqlite3
import datetime
conn = sqlite3.connect('db.sqlite3')
......@@ -65,6 +66,152 @@ def import_messages(conn):
pass
conn.commit()
import_jokes(conn)
import_fortunes(conn)
import_messages(conn)
\ No newline at end of file
def get_game_names(game_id_list):
games_file = 'games.json'
json_data=open(games_file).read()
data = json.loads(json_data)
result = []
for game_id in game_id_list:
if isinstance(game_id, str) and not game_id.isdigit():
result.append(game_id)
continue
name_set = False
for game in data:
if game['id'] == game_id:
result.append(game['name'])
name_set = True
return result
def dict_factory(cursor, row):
if row == None:
return None
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
def db_get_member(discord_id=None, username=None):
# Do a lookup by ID, if it's found but the name doesn't match then add a row to aliases with the previous name and change the member name
c = conn.cursor()
result = None
if discord_id:
result = c.execute("SELECT member_id, member_name, discord_id, discord_mention, is_afk, afk_at, status, prev_status, status_change_at, current_game FROM members WHERE discord_id = ?;", (discord_id,)).fetchone()
if username:
result = c.execute("SELECT member_id, member_name, discord_id, discord_mention, is_afk, afk_at, status, prev_status, status_change_at, current_game FROM members WHERE member_name = ?;", (username,)).fetchone()
return dict_factory(c, result)
def log(message):
print("{} - {}".format(datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S'), message))
def db_add_game(member_id, game_name):
# Do a lookup by ID, if it's found but the name doesn't match then add a row to aliases with the previous name and change the member name
c = conn.cursor()
games = c.execute("SELECT game_id FROM games WHERE game_name = ?;", (game_name,)).fetchone()
db_game_id = 0
if not games:
log("Adding Game: {}".format(game_name,))
c.execute("INSERT INTO games(game_name) VALUES(?);", (game_name,))
conn.commit()
db_game_id = c.execute("select last_insert_rowid();").fetchone()[0]
else:
db_game_id = games[0]
#log("DB Game ID: {}".format(db_game_id,))
member_games = c.execute("SELECT launch_count FROM xmember_games WHERE game_id = ? AND member_id = ?;", (db_game_id, member_id)).fetchone()
if not member_games:
#log("Inserting Member Games: {}, {}".format(db_game_id, member_id))
c.execute("INSERT INTO xmember_games(game_id, member_id, launch_count) VALUES(?, ?, 1);", (db_game_id, member_id))
conn.commit()
else:
#log("Updating Member Games: {}, {}".format(db_game_id, member_id))
c.execute("UPDATE xmember_games SET launch_count = launch_count + 1 WHERE game_id = ? AND member_id = ?;", (db_game_id, member_id))
conn.commit()
def db_create_member(member):
# Do a lookup by ID, if it's found but the name doesn't match then add a row to aliases with the previous name and change the member name
c = conn.cursor()
c.execute("""INSERT INTO members (member_name, discord_id, discord_mention,
is_afk, afk_at, status, prev_status,
status_change_at, current_game)
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?);""", (member.name.lower(),
member.id, member.mention,
0, datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S'),
'online', 'offline',
datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S'),
member.game_id))
conn.commit()
if member.game_id != None:
db_add_game(db_get_member(member.id)['member_id'], member.game_id)
class Member:
pass
def import_games(conn):
games_file = 'games.json'
members_file = 'members.json'
json_data=open(members_file).read()
member_data = json.loads(json_data)
json_data=open(games_file).read()
game_data = json.loads(json_data)
c = conn.cursor()
user_games = {}
for username in member_data:
if 'games_played' in member_data[username]:
for game_id in member_data[username]['games_played']:
if (game_id != 'None' and game_id != 0):
if username not in user_games:
user_games[username] = []
if game_id:
if isinstance( game_id, int) or game_id.isdigit():
game_names = get_game_names([game_id])
#print(game_names)
if len(game_names) > 0:
user_games[username].append(game_names[0])
else:
user_games[username].append(game_id)
#print(user_games)
for username, game_list in user_games.iteritems():
member = db_get_member(username=username)
if member:
for game in game_list:
db_add_game(member['member_id'], game)
print("Added Game: {} - {}".format(member['member_id'], game))
else:
if 'id' not in member_data[username]:
continue
member_to_create = Member()
member_to_create.name = username
member_to_create.id = member_data[username]['id']
member_to_create.mention = member_data[username]['mention']
member_to_create.game_id = None
db_create_member(member_to_create)
print("missing {}".format(byteify(username)))
print(member_to_create)
# 'id': user_id,
# 'mention': mention,
# 'is_afk': is_afk,
# 'afk_at': afk_at,
# 'status': status,
# 'prev_status': prev_status,
# 'status_change_at': status_change_at,
# 'game_id': game_id,
# 'games_played': games_played,
# 'aliases': aliases
# for username in data:
# print("Username: %s" % username)
# for author in data[username]:
# try:
# c.execute("INSERT INTO messages (message, delivery_time, channel, message_from, message_to, user_id) VALUES (?, ?, ?, ?, ?, ?)", (data[username][author]['message'], data[username][author]['delivery_time'],data[username][author]['channel'], author, username, data[username][author]['user_id']))
# except Exception as e:
# print(e)
# pass
# conn.commit()
#import_jokes(conn)
#import_fortunes(conn)
#import_messages(conn)
#import_games(conn)
\ No newline at end of file
......
......@@ -3,6 +3,7 @@ import discord
import random
import datetime
import re
import operator
import traceback
import sys
......@@ -34,6 +35,14 @@ muted_until = datetime.datetime.now()
client = discord.Client()
wolf = {}
#####################
## Utility Functions
#####################
def log(message):
print("{} - {}".format(datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S'), message))
def format_exception(e):
exception_list = traceback.format_stack()
exception_list = exception_list[:-2]
......@@ -89,76 +98,228 @@ def search_google_images(query, animated=False):
return search_result
return "boo you fail.."
@client.event
def on_socket_raw_send(payload, binary=False):
check_msg_queue()
##################
## Database Calls
##################
@client.event
def on_status(member):
#print("Status Changed %s" % (member,))
try:
json_data=open(member_status).read()
data = json.loads(json_data)
print(json_data)
except ValueError:
data = {}
if not data:
data = {}
try:
username = member.name.lower()
user_id = member.id
mention = member.mention()
if username in data:
is_afk = data[username]['is_afk']
afk_at = data[username]['afk_at']
status = data[username]['status']
prev_status = data[username]['prev_status']
status_change_at = data[username]['status_change_at']
game_id = data[username]['game_id']
games_played = data[username]['games_played']
aliases = data[username]['aliases']
# Converts a row into a dictionary
def dict_factory(cursor, row):
if row == None:
return None
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
def db_add_message(message, delivery_time, channel, message_from, message_to, user_id):
c = conn.cursor()
c.execute("""INSERT INTO messages(message, delivery_time, channel, message_from, message_to, user_id)
VALUES(?, ?, ?, ?, ?, ?);""", (message, delivery_time, channel, message_from, message_to, user_id))
conn.commit()
def db_delete_sent_message(message_id):
c = conn.cursor()
c.execute("DELETE FROM messages WHERE message_id = ?;", (message_id,))
conn.commit()
def db_get_aliases(member_id):
c = conn.cursor()
aliases = c.execute("SELECT alias_name FROM aliases WHERE member_id = ?;", (member_id,)).fetchall()
if aliases:
alias_list = []
for alias in aliases:
alias_list.append(alias[0])
return alias_list
else:
is_afk = False
afk_at = datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S')
status = 'online'
prev_status = 'offline'
status_change_at = datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S')
game_id = None
games_played = []
aliases = []
return None
def db_add_aliases(member_id, alias_name):
c = conn.cursor()
c.execute("INSERT INTO aliases(alias_name, member_id) VALUES (?, ?);", (alias_name, member_id,))
conn.commit()
def db_get_messages():
msg_conn = sqlite3.connect('db.sqlite3')
c = msg_conn.cursor()
messages = c.execute("SELECT * FROM messages WHERE datetime('now') >= datetime( replace(delivery_time, '/', '-'));").fetchall()
if messages:
db_messages = []
for message in messages:
db_messages.append(dict_factory(c, message))
else:
db_messages = None
msg_conn.close()
return db_messages
def db_get_whoplayed(game_name):
c = conn.cursor()
members = c.execute("""SELECT m.member_name, xmg.launch_count
FROM members m
INNER JOIN xmember_games xmg ON
m.member_id = xmg.member_id
INNER JOIN games g ON
g.game_id = xmg.game_id
WHERE g.game_name COLLATE nocase = ?
Order By xmg.launch_count, m.member_name DESC;""", (game_name,)).fetchall()
member_list = {}
for member in members:
member_list[member[0]] = member[1]
#log(member_list)
return sorted(member_list.items(), reverse=True, key=operator.itemgetter(1))
#return sorted(member_list, reverse=True, key=lambda tup: tup[1])
def db_get_games(username):
c = conn.cursor()
games = c.execute("""SELECT g.game_name, xmg.launch_count FROM games g
INNER JOIN xmember_games xmg ON
g.game_id = xmg.game_id
INNER JOIN members m ON
m.member_id = xmg.member_id
WHERE m.member_name COLLATE nocase = ?;""", (username,)).fetchall()
games_list = {}
for game in games:
games_list[game[0]] = game[1]
return games_list
def db_get_games_list(limit):
c = conn.cursor()
games_list = c.execute("""SELECT g.game_name, count(DISTINCT xmg.member_id)
FROM games g
INNER JOIN xmember_games xmg ON
g.game_id = xmg.game_id
Group By xmg.game_id
Order By COUNT(DISTINCT xmg.member_id) DESC
LIMIT ?""", (limit,)).fetchall()
return games_list
def db_add_game(member_id, game_name):
# Do a lookup by ID, if it's found but the name doesn't match then add a row to aliases with the previous name and change the member name
c = conn.cursor()
games = c.execute("SELECT game_id FROM games WHERE game_name = ?;", (game_name,)).fetchone()
db_game_id = 0
if not games:
log("Adding Game: {}".format(game_name,))
c.execute("INSERT INTO games(game_name) VALUES(?);", (game_name,))
conn.commit()
db_game_id = c.execute("select last_insert_rowid();").fetchone()[0]
else:
db_game_id = games[0]
#log("DB Game ID: {}".format(db_game_id,))
member_games = c.execute("SELECT launch_count FROM xmember_games WHERE game_id = ? AND member_id = ?;", (db_game_id, member_id)).fetchone()
if not member_games:
#log("Inserting Member Games: {}, {}".format(db_game_id, member_id))
c.execute("INSERT INTO xmember_games(game_id, member_id, launch_count) VALUES(?, ?, 1);", (db_game_id, member_id))
conn.commit()
else:
#log("Updating Member Games: {}, {}".format(db_game_id, member_id))
c.execute("UPDATE xmember_games SET launch_count = launch_count + 1 WHERE game_id = ? AND member_id = ?;", (db_game_id, member_id))
conn.commit()
def db_get_member(discord_id=None, username=None):
# Do a lookup by ID, if it's found but the name doesn't match then add a row to aliases with the previous name and change the member name
member_conn = sqlite3.connect('db.sqlite3')
c = member_conn.cursor()
result = None
if discord_id:
result = c.execute("SELECT member_id, member_name, discord_id, discord_mention, is_afk, afk_at, status, prev_status, status_change_at, current_game FROM members WHERE discord_id = ?;", (discord_id,)).fetchone()
if username:
result = c.execute("SELECT member_id, member_name, discord_id, discord_mention, is_afk, afk_at, status, prev_status, status_change_at, current_game FROM members WHERE member_name = ?;", (username,)).fetchone()
member_conn.close()
return dict_factory(c, result)
def db_create_member(member):
# Do a lookup by ID, if it's found but the name doesn't match then add a row to aliases with the previous name and change the member name
c = conn.cursor()
c.execute("""INSERT INTO members (member_name, discord_id, discord_mention,
is_afk, afk_at, status, prev_status,
status_change_at, current_game)
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?);""", (member.name.lower(),
member.id, member.mention(),
0, datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S'),
'online', 'offline',
datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S'),
member.game_id))
conn.commit()
if member.game_id != None:
db_add_game(db_get_member(member.id)['member_id'], member.game_id)
def db_update_member(member, db_member):
# Do a lookup by ID, if it's found but the name doesn't match then add a row to aliases with the previous name and change the member name
db_member_id = db_member['member_id']
db_membername = db_member['member_name']
status = db_member['status']
prev_status = db_member['prev_status']
c = conn.cursor()
if member.name.lower() != db_membername:
log("Member Name changed! {} to {}".format(db_membername, member.name.lower()))
c.execute("UPDATE members SET member_name = ? WHERE discord_id = ?;", (member.name.lower(), member.id,))
conn.commit()
aliases = c.execute("SELECT * FROM aliases WHERE alias_name = ? AND member_id = ?;", (db_membername, db_member_id)).fetchone()
log("Alias list for user: {}".format(aliases))
if aliases == None:
log("creating new alias: {}, {}".format(db_membername, db_member_id))
c.execute("INSERT INTO aliases (alias_name, member_id) VALUES (?, ?);", (db_membername, db_member_id))
conn.commit()
if member.status == 'idle':
afk_at = datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S')
is_afk = True
else:
is_afk = False
status_change_at = None
if status != member.status:
prev_status = status
status = member.status
status_change_at = datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S')
if game_id != member.game_id:
game_id = member.game_id
if game_id not in games_played:
games_played.append(game_id)
data[username] = {
'id': user_id,
'mention': mention,
'is_afk': is_afk,
'afk_at': afk_at,
'status': status,
'prev_status': prev_status,
'status_change_at': status_change_at,
'game_id': game_id,
'games_played': games_played,
'aliases': aliases
}
#print('Status Change: %s' % (data,))
jdata = json.dumps(data, ensure_ascii=False)
except Exception as e:
print('Error saving status change: %s' % (e),)
return
if is_afk:
#log("is afk")
c.execute("""UPDATE members
SET is_afk = ?, afk_at = ?, status = ?,
prev_status = ?, status_change_at = ?
WHERE discord_id = ?;""", (1, afk_at, status, prev_status, status_change_at, member.id))
conn.commit()
else:
#log("is not afk")
c.execute("""UPDATE members
SET is_afk = ?, status = ?,
prev_status = ?, status_change_at = ?
WHERE discord_id = ?;""", (0, status, prev_status, status_change_at, member.id))
conn.commit()
c.execute("UPDATE members SET current_game = ? WHERE discord_id = ?;", (member.game_id, member.id))
conn.commit()
#log("Member: {} \nMember GameID: {} db Game id: {}".format(member, member.game_id, db_member['current_game']))
if member.game_id != None and member.game_id != db_member['current_game']:
db_add_game(db_member['member_id'], member.game_id)
#################
## Client Events
#################
@client.event
def on_socket_raw_send(payload, binary=False):
check_msg_queue()
@client.event
def on_status(member):
try:
db_member = db_get_member(member.id)
#log(db_member)
if not db_member:
log("Creating new member: {}".format(member) )
db_create_member(member)
else:
#log("Updating member: {}".format(member) )
db_update_member(member, db_member)
open(member_status, 'wb+').write(jdata.encode('utf8'))
check_msg_queue()
except Exception as e:
log("Exception: {}".format(format_exception(e)))
pass
def get_game_names(game_id_list):
json_data=open(games_file).read()
......@@ -190,47 +351,22 @@ def get_mention_status(mention):
return None
def check_msg_queue():
print("checking messages")
#print("checking messages")
messages = db_get_messages()
if messages:
for message in messages:
try:
json_data=open(deliveries_file).read()
data = json.loads(json_data)
except ValueError:
data = {}
if not data:
data = {}
#print("Data: %s" % data)
new_data = {}
for username in data:
for author in data[username]:
print("Message: %s" % data[username][author])
delivery = datetime.datetime.strptime(data[username][author]['delivery_time'], '%Y/%m/%d %H:%M:%S')
if delivery <= datetime.datetime.now():
offline = False
for member in client.get_all_members():
print('MEMBER MENTION: %s USERNAME: %s' % (member.mention(), username))
if username == member.mention():
if member.status != 'online':
print('OFFLINE USER, TRY AGAIN LATER')
offline = True
break
if offline:
new_data[username] = {}
new_data[username][author] = data[username][author]
break
channel = Object(data[username][author]['channel'])
message = data[username][author]['message']
client.send_message(channel, '{}, {} asked me to tell you "{}"'.format(username, author, message))
else:
new_data[username] = {}
new_data[username][author] = data[username][author]
jdata = json.dumps(new_data, ensure_ascii=False)
#print("New Data: %s" % new_data)
open(deliveries_file, 'wb+').write(jdata.encode('utf8'))
member = db_get_member(filter(unicode.isalnum, message['message_to']))
if member:
if message['message_to'] == member['discord_mention']:
print("Found Message: {} - {} - Status: {} Channel: {}".format(message['message_to'], member['discord_mention'], member['status'], message['channel']))
if member['status'] == 'online':
client.send_message(Object(message['channel']), '{}, {} asked me to tell you "{}"'.format(message['message_to'], message['message_from'], message['message']))
db_delete_sent_message(message['message_id'])
except Exception as e:
log("{}\nFailed to send message: {}".format(format_exception(e), message['message_id'],))
return
@client.event
def on_message(message):
#print message.content
......@@ -282,32 +418,26 @@ Stuff:
return
if message.content.startswith('!lastseen'):
data = None
try:
json_data=open(member_status).read()
data = json.loads(json_data)
except ValueError:
pass
if not data:
client.send_message(message.channel, 'I am a bit confused right now.. maybe I need more data. {}!'.format(message.author.mention()))
else:
username = message.content[10:].replace('@', '').lower()
if username in data:
member = db_get_member(username=username)
log(member)
if member:
out_string = ''
if data[username]['is_afk'] == True:
out_string = 'Went AFK at: {}\n'.format(data[username]['afk_at'])
elif data[username]['status'] == 'offline':
if member['is_afk'] == 1:
out_string = 'Went AFK at: {}\n'.format(member['afk_at'])
elif member['status'] == 'offline':
out_string = 'Currently Offline\n'
else:
out_string = 'Currently Online\n'
out_string += 'Last Status: {} at {} which was {}\nPrevious Status: {}\n'.format(data[username]['status'],
data[username]['status_change_at'],
human(datetime.datetime.strptime(data[username]['status_change_at'], '%Y/%m/%d %H:%M:%S')),
data[username]['prev_status'])
out_string += 'Last Status: {} at {} which was {}\nPrevious Status: {}\n'.format(member['status'],
member['status_change_at'],
human(datetime.datetime.strptime(member['status_change_at'], '%Y/%m/%d %H:%M:%S')),
member['prev_status'])
client.send_message(message.channel, 'Last Information on {}:\n{}'.format(username, out_string))
else:
client.send_message(message.channel, 'I don\'t have any data on {} yet {}'.format(username, message.author.mention()))
return
if message.content.startswith('!shutup'):
muted_until = datetime.datetime.now() + datetime.timedelta(minutes=5)
......@@ -360,35 +490,16 @@ Stuff:
client.send_message(message.channel, out_string)
return
if message.content.startswith('!gameslist'):
data = None
try:
json_data=open(member_status).read()
data = json.loads(json_data)
except ValueError:
pass
if not data:
client.send_message(message.channel, 'I am a bit confused right now.. maybe I need more data. {}!'.format(message.author.mention()))
else:
if message.content.startswith('!gameslist') or message.content.startswith('!gamelist') :
parts = message.content.split(' ')
limit = 20
if len(parts) > 1 and parts[1].isdigit():
limit = int(parts[1])
games_list = db_get_games_list(limit)
game_list = []
for user in data:
if 'games_played' in data[user]:
#print('%s' % data[user]['games_played'])
game_list += data[user]['games_played']
print('%s' % game_list)
games_sorted = leaders(get_game_names(game_list), top=limit)
print('%s' % games_sorted)
out_string = ''
for game in games_sorted:
#print('%s' % game)
out_string += ' {} - {}\n'.format(game[1], game[0])
for game in games_list:
out_string += ' {} - {}\n'.format(game[1], byteify(game[0]))
client.send_message(message.channel, 'The games I have seen people playing are: ')
while len(out_string) > 0:
client.send_message(message.channel, out_string[:1900])
......@@ -397,99 +508,54 @@ Stuff:
return
if message.content.startswith('!aliases'):
data = None
try:
json_data=open(member_status).read()
data = json.loads(json_data)
except ValueError:
pass
if not data:
client.send_message(message.channel, 'I am a bit confused right now.. maybe I need more data. {}!'.format(message.author.mention()))
else:
username = message.content[9:].replace('@', '').lower()
if username.strip() == '':
client.send_message(message.channel, '{} please provide a username. !aliases <username>'.format(message.author.mention()))
return
if username in data and 'aliases' in data[username]:
client.send_message(message.channel, '{} has the following aliases: {}'.format(username, ', '.join(data[username]['aliases'])))
member = db_get_member(username=username)
if member:
aliases = db_get_aliases(member['member_id'])
if aliases:
client.send_message(message.channel, '{} has the following aliases: {}'.format(username, ', '.join(aliases)))
else:
client.send_message(message.channel, 'No known alises for {} yet {}'.format(username, message.author.mention()))
else:
client.send_message(message.channel, 'I don\'t know who you are speaking of {}!'.format(message.author.mention()))
return
if message.content.startswith('!addalias'):
data = None
try:
json_data=open(member_status).read()
data = json.loads(json_data)
except ValueError:
pass
if not data:
client.send_message(message.channel, 'I am a bit confused right now.. maybe I need more data. {}!'.format(message.author.mention()))
else:
alias = message.content[10:]
username = message.author.name.lower()
if username in data:
if 'aliases' not in data[username]:
data[username]['aliases'] = []
data[username]['aliases'].append(alias)
jdata = json.dumps(data, ensure_ascii=False)
open(member_status, 'wb+').write(jdata.encode('utf8'))
member = db_get_member(username=username)
if member:
db_add_aliases(member['member_id'], alias)
client.send_message(message.channel, '{} has been added to your aliases'.format(alias))
else:
client.send_message(message.channel, 'Something horrible happened and it is all your fault.')
client.send_message(message.channel, 'Something horrible happened and it is all your fault, try logging out / on again or play a game. (or fuck off i dunno i\'m just an error message. Who am I to tell you how to run your life...)')
return
if message.content.startswith('!games'):
data = None
try:
json_data=open(member_status).read()
data = json.loads(json_data)
except ValueError:
pass
if not data:
client.send_message(message.channel, 'I am a bit confused right now.. maybe I need more data. {}!'.format(message.author.mention()))
else:
username = message.content[7:].replace('@', '').lower()
if username in data:
games = ', '.join(get_game_names(data[username]['games_played']))
games_list = db_get_games(username)
if games_list:
games = ', '.join(games_list)
client.send_message(message.channel, 'I have seen {} playing: {}'.format(username, games))
else:
client.send_message(message.channel, 'I don\'t have any data on {} yet {}'.format(username, message.author.mention()))
return
if message.content.startswith('!whoplayed'):
member_data = None
try:
json_data=open(member_status).read()
member_data = json.loads(json_data)
except ValueError:
pass
if not member_data:
client.send_message(message.channel, 'I am a bit confused right now.. maybe I need more data. {}!'.format(message.author.mention()))
else:
game_name = message.content[11:]
json_data=open(games_file).read()
data = json.loads(json_data)
game_id = 0
for game in data:
if game['name'].lower() == game_name.lower():
game_id = game['id']
#if game_id == 0:
# #client.send_message(message.channel, 'I don\'t have any data on {} yet {}'.format(game_name, message.author.mention()))
# #return
matched_usernames = []
for username in member_data:
if 'games_played' in member_data[username]:
for id in member_data[username]['games_played']:
if id == game_name or (id == game_id and game_id != 0):
matched_usernames.append(username)
if len(matched_usernames) == 0:
client.send_message(message.channel, 'I don\'t have any data on {} yet {}'.format(game_name, message.author.mention()))
member_list = db_get_whoplayed(game_name)
if not member_list:
client.send_message(message.channel, 'I don\'t have any data on {} yet {}'.format(byteify(game_name), message.author.mention()))
else:
client.send_message(message.channel, 'I have seen {} playing: {}'.format(', '.join(matched_usernames), game_name))
out_string = ''
for member in member_list:
out_string += ' {} - {}\n'.format(byteify(member[1]), byteify(member[0]))
client.send_message(message.channel, 'Below is a list of people who have played {} and the number of times they have launched the game:'.format(byteify(game_name),))
while len(out_string) > 0:
client.send_message(message.channel, out_string[:1900])
out_string = out_string[1900:]
return
# !msg joe in 5 minutes YOU ARE A DICK
if message.content.startswith('!msg'):
try:
......@@ -530,6 +596,7 @@ Stuff:
username = message_bits[1]
user_mention = ''
# TODO: have it look in the database. Do this AFTER on startup we add all users.
for member in client.get_all_members():
print("MEMBER: %s" % member)
if username.lower() == member.name.lower():
......@@ -542,16 +609,17 @@ Stuff:
msg_text = byteify(' '.join(message_bits[msg_idx:]))
message = {'user_id': user_id, 'channel': channel.id, 'delivery_time': msg_datetime.strftime('%Y/%m/%d %H:%M:%S'), 'message': msg_text}
print("Message: %s" % message)
data[user_mention] = {}
data[user_mention][author.mention()] = message
jdata = json.dumps(data, ensure_ascii=False)
print("Data: %s" % data)
db_add_message(msg_text, msg_datetime.strftime('%Y-%m-%d %H:%M:%S'), channel.id, author.mention(), user_mention, user_id)
# data[user_mention] = {}
# data[user_mention][author.mention()] = message
# jdata = json.dumps(data, ensure_ascii=False)
# print("Data: %s" % data)
#test_ch = Object(channel.id)
#client.send_message(test_ch, 'Test Message {}.'.format(author))
except Exception as e:
client.send_message(channel, 'Your shitty message has been rejected {}. {}'.format(author.name, e))
return
open(deliveries_file, 'wb+').write(jdata.encode('utf8'))
# open(deliveries_file, 'wb+').write(jdata.encode('utf8'))
if msg_datetime < datetime.datetime.now():
client.send_message(channel, '{} your message will be delivered to {} as soon as they are available.'.format(author.name, user_mention))
else:
......@@ -675,6 +743,7 @@ def on_ready():
print(client.user.name)
print(client.user.id)
print('------')
check_msg_queue()
retries = 0
while retries < 1000:
......@@ -683,7 +752,6 @@ while retries < 1000:
creds = json.loads(json_data)
wolf = wolframalpha.Client(creds['wolframkey'])
client.login(creds['username'], creds['password'])
client.run()
except KeyboardInterrupt:
conn.close
......
{"zan": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/24 09:25:10", "mention": "<@65178351664377856>", "prev_status": "online", "game_id": "Dragon's Dogma: Dark Arisen", "games_played": ["If My Heart Had Wings", "World of Warcraft", null, "XCOM: Enemy Unknown", "Go! Go! Nippon! ~My First Trip to Japan~", "Dragon's Dogma: Dark Arisen"], "afk_at": "2016/01/24 09:20:06", "id": "65178351664377856", "aliases": []}, "solidsteak": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 08:52:15", "mention": "<@62955839694053376>", "prev_status": "online", "game_id": "Rainbow Six Siege", "games_played": [248, null, 310, 533, 448, 715, 1, "Insurgency", "Rainbow Six Siege"], "afk_at": "2016/01/24 08:52:15", "id": "62955839694053376", "aliases": []}, "apple": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 09:34:37", "mention": "<@121822410096771072>", "prev_status": "idle", "games_played": [1, 6, null, "FINAL FANTASY XIV", "Borderlands 2"], "game_id": "FINAL FANTASY XIV", "afk_at": "2016/01/24 05:11:24", "id": "121822410096771072", "aliases": []}, "sheik": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/22 12:56:00", "mention": "<@48148712194576384>", "prev_status": "online", "game_id": "Guild Wars 2", "games_played": [283, null, 5, 11, 310, 249, 659, 308, 6, 260, 182, "Diablo 3", "Guild Wars 2", "Metal Gear Solid V: The Phantom Pain"], "afk_at": "2016/01/22 12:37:49", "id": "48148712194576384", "aliases": []}, "puncherboxer": {"status": "offline", "is_afk": false, "status_change_at": "2015/12/04 04:11:44", "mention": "<@118544498996412416>", "prev_status": "online", "games_played": [], "game_id": null, "afk_at": "2015/12/04 03:48:11", "id": "118544498996412416"}, "rae": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 09:55:52", "mention": "<@48162082507456512>", "prev_status": "online", "game_id": "Dragon's Dogma: Dark Arisen", "games_played": [488, null, 141, "Dark Souls II", "Black Desert Online", "Dragon's Dogma: Dark Arisen"], "afk_at": "2016/01/24 09:55:52", "id": "48162082507456512", "aliases": []}, "marion": {"status": "offline", "is_afk": false, "status_change_at": "2015/12/03 05:14:48", "prev_status": "online", "games_played": [1, null], "game_id": null, "afk_at": "2015/12/02 08:30:16"}, "shyrith": {"status": "offline", "is_afk": false, "status_change_at": "2015/12/03 08:10:52", "prev_status": "online", "games_played": [1, 644, null], "game_id": null, "afk_at": "2015/12/02 21:54:35"}, "hiimapirate": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/12 05:08:57", "mention": "<@133758935009198080>", "prev_status": "online", "games_played": [], "game_id": null, "afk_at": "2015/12/20 11:34:43", "id": "133758935009198080", "aliases": []}, "az": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/23 06:17:41", "mention": "<@127330097949573121>", "prev_status": "online", "games_played": [], "game_id": null, "afk_at": "2015/12/19 06:10:40", "id": "127330097949573121", "aliases": []}, "yung_thirsty": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/24 08:36:17", "mention": "<@136368619423531008>", "prev_status": "online", "games_played": ["League of Legends", "Amnesia: The Dark Descent", "Clicker Heroes", "Crusader Kings II"], "game_id": "League of Legends", "afk_at": "2016/01/12 07:22:37", "id": "136368619423531008", "aliases": []}, "goshzilla": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 09:04:18", "mention": "<@47934670406422528>", "prev_status": "online", "games_played": [3, null, 6, 7, 777, "League of Legends", "Monster Hunter Online"], "game_id": "Monster Hunter Online", "afk_at": "2016/01/24 09:04:18", "id": "47934670406422528", "aliases": []}, "herbeh": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/11 10:46:35", "mention": "<@105392869782622208>", "prev_status": "online", "game_id": null, "games_played": [], "afk_at": "2016/01/11 08:46:57", "id": "105392869782622208", "aliases": []}, "eeri": {"status": "offline", "is_afk": false, "status_change_at": "2015/12/15 06:31:49", "mention": "<@122023217371021313>", "prev_status": "online", "game_id": null, "games_played": [659, null], "afk_at": "2015/12/15 06:09:09", "id": "122023217371021313", "aliases": []}, "dick": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 10:00:54", "mention": "<@78767611436863488>", "prev_status": "online", "game_id": "Black Desert Online", "games_played": [372, null, 1, 488, "Dark Souls", "Metal Gear Solid V: The Phantom Pain", "Phantasy Star Online 2", "Black Desert Online"], "afk_at": "2016/01/24 10:00:54", "id": "78767611436863488", "aliases": []}, "arka": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 10:13:07", "mention": "<@121466618126532608>", "prev_status": "idle", "games_played": [1, null, 313, 488, "FINAL FANTASY XIV"], "game_id": "FINAL FANTASY XIV", "afk_at": "2016/01/24 09:57:47", "id": "121466618126532608", "aliases": []}, "wriggle": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/16 19:20:41", "mention": "<@80169354666192896>", "prev_status": "online", "games_played": [], "game_id": null, "afk_at": "2015/12/02 15:37:49", "id": "80169354666192896", "aliases": []}, "tim": {"status": "offline", "is_afk": false, "status_change_at": "2015/12/04 10:25:19", "mention": "<@109145030354030592>", "prev_status": "online", "game_id": null, "games_played": [], "afk_at": "2015/12/04 07:08:23", "id": "109145030354030592"}, "charisma": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 07:23:41", "mention": "<@65187139276513280>", "prev_status": "online", "game_id": "Dragon's Dogma: Dark Arisen", "games_played": [313, null, 807, 471, 671, 728, 0, "Sony Playstation Emulator", "Black Desert Online", "Dragon's Dogma: Dark Arisen"], "afk_at": "2016/01/24 07:23:41", "id": "65187139276513280", "aliases": []}, "mate": {"status": "offline", "is_afk": false, "status_change_at": "2015/12/04 09:11:30", "mention": "<@109145154044071936>", "prev_status": "online", "game_id": null, "games_played": [], "afk_at": "2015/12/04 05:06:58", "id": "109145154044071936"}, "sig": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/23 13:11:50", "mention": "<@104055037243707392>", "prev_status": "online", "games_played": [8, null, 7, 466, 588, 15, 6, 13, 165, 669, 101, "Diablo 3", "Tabletop Simulator", "DOTA 2", "Crusader Kings II"], "game_id": "DOTA 2", "afk_at": "2016/01/23 05:03:03", "id": "104055037243707392", "aliases": []}, "bunta": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 05:09:39", "mention": "<@122520378089275395>", "prev_status": "online", "game_id": null, "games_played": [488, null], "afk_at": "2016/01/24 05:09:39", "id": "122520378089275395", "aliases": []}, "mr. nelson": {"status": "offline", "is_afk": false, "status_change_at": "2015/12/14 13:35:09", "mention": "<@103311664748707840>", "prev_status": "online", "game_id": null, "games_played": [], "afk_at": "2015/12/14 10:25:27", "id": "103311664748707840", "aliases": []}, "草 goshzilla": {"status": "online", "is_afk": false, "status_change_at": "2016/01/15 15:28:19", "mention": "<@47934670406422528>", "prev_status": "offline", "game_id": null, "games_played": [], "afk_at": "2016/01/15 08:23:14", "id": "47934670406422528", "aliases": []}, "skeletonhorn": {"status": "online", "is_afk": false, "status_change_at": "2015/12/03 00:36:39", "prev_status": "offline", "games_played": [], "game_id": null, "afk_at": "2015/12/03 00:36:39"}, "yoltan": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/08 23:38:09", "mention": "<@122369674808786948>", "prev_status": "online", "games_played": [238, null, 307], "game_id": null, "afk_at": "2015/12/04 16:14:00", "id": "122369674808786948", "aliases": []}, "rui": {"status": "online", "mention": "<@63649222993391616>", "is_afk": false, "games_played": [174, null, 660, 724, 488, 149, 780, 301, 438, 140, 680, "Grand Theft Auto V", "Dragon's Dogma: Dark Arisen"], "game_id": "Dragon's Dogma: Dark Arisen", "afk_at": "2016/01/24 09:55:44", "status_change_at": "2016/01/24 10:04:13", "id": "63649222993391616", "prev_status": "idle", "aliases": []}, "adol": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/24 04:45:52", "mention": "<@122079633796497409>", "prev_status": "online", "game_id": "Clicker Heroes", "games_played": [550, null, 1, "Black Desert Online", "Clicker Heroes"], "afk_at": "2016/01/24 03:10:24", "id": "122079633796497409", "aliases": []}, "xorfos": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 06:54:12", "mention": "<@121019458700443650>", "prev_status": "online", "game_id": "Cook, Serve, Delicious!", "games_played": [430, null, 550, 140, "Dwarf Fortress", "Tales of Zestiria", "Cook, Serve, Delicious!"], "afk_at": "2016/01/24 06:54:12", "id": "121019458700443650", "aliases": []}, "roris": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/24 08:10:56", "mention": "<@80876422352076800>", "prev_status": "online", "game_id": "Dragon's Dogma: Dark Arisen", "games_played": [1, null, 0, 658, 345, 724, 471, 269, 307, "Grandia 2", "Black Desert Online", "Dragon's Dogma: Dark Arisen"], "afk_at": "2016/01/24 00:50:04", "id": "80876422352076800", "aliases": []}, "projectaria": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 10:06:36", "mention": "<@48146724769763328>", "prev_status": "idle", "game_id": "Nintendo Emulator", "games_played": [1, null, "Nintendo Emulator"], "afk_at": "2016/01/24 09:13:15", "id": "48146724769763328", "aliases": []}, "moss": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/24 10:15:27", "mention": "<@48168872238387200>", "prev_status": "online", "games_played": [0, null, 1, 715, 127, 206, 440], "game_id": null, "afk_at": "2016/01/20 23:28:15", "id": "48168872238387200", "aliases": []}, "master of moisture": {"status": "offline", "is_afk": false, "status_change_at": "2015/12/20 10:57:33", "mention": "<@112340697771765760>", "prev_status": "idle", "game_id": null, "games_played": [], "afk_at": "2015/12/20 10:52:58", "id": "112340697771765760", "aliases": []}, "hellsbreath:skull:": {"status": "online", "is_afk": false, "status_change_at": "2015/12/10 15:13:36", "mention": "<@78767557628133376>", "prev_status": "offline", "games_played": [], "game_id": null, "afk_at": "2015/12/10 15:13:36", "id": "78767557628133376", "aliases": []}, "hellsbreath :skull:": {"status": "online", "is_afk": false, "status_change_at": "2015/12/10 15:13:50", "mention": "<@78767557628133376>", "prev_status": "offline", "game_id": null, "games_played": [], "afk_at": "2015/12/10 15:13:50", "id": "78767557628133376", "aliases": []}, "yobi": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 10:14:51", "mention": "<@65180855919714304>", "prev_status": "online", "game_id": null, "games_played": [3, null, 680, 379, "Unity", "World of Warcraft"], "afk_at": "2016/01/24 10:14:51", "id": "65180855919714304", "aliases": []}, "salt": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 07:12:09", "mention": "<@48140539459010560>", "prev_status": "idle", "games_played": [466, 8, null, 680, 588, 15, 512, 260, "Hearthstone", "Tabletop Simulator", "Crusader Kings II"], "game_id": "Hearthstone", "afk_at": "2016/01/24 06:42:59", "id": "48140539459010560", "aliases": []}, "study": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 10:14:35", "mention": "<@121821978222002178>", "prev_status": "idle", "games_played": ["FINAL FANTASY XIV", "Rocket League", "Dragon's Dogma: Dark Arisen"], "game_id": "Dragon's Dogma: Dark Arisen", "afk_at": "2016/01/24 10:14:15", "id": "121821978222002178", "aliases": []}, "草 goshzilla 一角": {"status": "online", "is_afk": false, "status_change_at": "2016/01/17 18:31:46", "mention": "<@47934670406422528>", "prev_status": "idle", "game_id": "League of Legends", "games_played": ["League of Legends"], "afk_at": "2016/01/17 18:27:26", "id": "47934670406422528", "aliases": []}, "grey": {"status": "online", "is_afk": false, "status_change_at": "2016/01/23 03:54:03", "mention": "<@48120346410221568>", "prev_status": "offline", "games_played": [550, null, 1, 208, 283, 318, "Counter-Strike: Global Offensive", "FINAL FANTASY XIV", "Skyforge", "Dark Souls II", "Crypt of the NecroDancer", "", "Rocket League", "Dragon's Dogma: Dark Arisen"], "game_id": "Dark Souls II", "afk_at": "2016/01/20 10:14:28", "id": "48120346410221568", "aliases": []}, "hellsbreath": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 10:08:27", "mention": "<@78767557628133376>", "prev_status": "offline", "games_played": [326, null, 660, 680, 566, 441, 363, 488, 246, "The Last Remnant", "Phantasy Star Online 2", "FINAL FANTASY XI", "Rainbow Six Siege", "Tales of Zestiria", "SolForge"], "game_id": "SolForge", "afk_at": "2016/01/24 09:04:01", "id": "78767557628133376", "aliases": ["Barry", "Ben Killin", "Hellsbreath", "Barry", "Ben Killin"]}, "green": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 06:54:32", "mention": "<@63098846506397696>", "prev_status": "idle", "games_played": [4, null, 3, 11, "League of Legends"], "game_id": "League of Legends", "afk_at": "2016/01/24 06:50:07", "id": "63098846506397696", "aliases": []}, "azia": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 01:01:33", "mention": "<@121404665727418368>", "prev_status": "offline", "games_played": ["Dragon's Dogma: Dark Arisen"], "game_id": "Dragon's Dogma: Dark Arisen", "afk_at": "2016/01/23 06:32:51", "id": "121404665727418368", "aliases": []}, "scoops": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/24 01:44:34", "mention": "<@65211875771559936>", "prev_status": "online", "games_played": [347, null, 0, 644, 308, 15, 3, 306, 351, "Counter-Strike: Global Offensive", "Rocket League"], "game_id": null, "afk_at": "2016/01/23 19:28:16", "id": "65211875771559936", "aliases": []}, "richter": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/24 06:50:08", "mention": "<@49237234515181568>", "prev_status": "online", "games_played": [488, null, 183, 11], "game_id": null, "afk_at": "2016/01/24 05:30:10", "id": "49237234515181568", "aliases": []}, "cae": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 07:15:06", "mention": "<@65178683714830336>", "prev_status": "online", "game_id": null, "games_played": [335, null, 215, 112, 274, 443, "Undertale"], "afk_at": "2016/01/24 07:15:06", "id": "65178683714830336", "aliases": []}}
\ No newline at end of file
{"zan": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 23:39:00", "mention": "<@65178351664377856>", "prev_status": "idle", "games_played": ["If My Heart Had Wings", "World of Warcraft", null, "XCOM: Enemy Unknown", "Go! Go! Nippon! ~My First Trip to Japan~", "Dragon's Dogma: Dark Arisen"], "game_id": "Dragon's Dogma: Dark Arisen", "afk_at": "2016/01/24 23:38:52", "id": "65178351664377856", "aliases": []}, "solidsteak": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 23:56:33", "mention": "<@62955839694053376>", "prev_status": "idle", "games_played": [248, null, 310, 533, 448, 715, 1, "Insurgency", "Rainbow Six Siege"], "game_id": null, "afk_at": "2016/01/24 23:05:50", "id": "62955839694053376", "aliases": []}, "apple": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 22:57:47", "mention": "<@121822410096771072>", "prev_status": "online", "games_played": [1, 6, null, "FINAL FANTASY XIV", "Borderlands 2"], "game_id": "FINAL FANTASY XIV", "afk_at": "2016/01/24 22:57:47", "id": "121822410096771072", "aliases": []}, "sheik": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 23:09:43", "mention": "<@48148712194576384>", "prev_status": "online", "games_played": [283, null, 5, 11, 310, 249, 659, 308, 6, 260, 182, "Diablo 3", "Guild Wars 2", "Metal Gear Solid V: The Phantom Pain", "Dragon's Dogma: Dark Arisen"], "game_id": null, "afk_at": "2016/01/24 23:09:43", "id": "48148712194576384", "aliases": []}, "puncherboxer": {"status": "offline", "is_afk": false, "status_change_at": "2015/12/04 04:11:44", "mention": "<@118544498996412416>", "prev_status": "online", "games_played": [], "game_id": null, "afk_at": "2015/12/04 03:48:11", "id": "118544498996412416"}, "rae": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 23:53:05", "mention": "<@48162082507456512>", "prev_status": "idle", "games_played": [488, null, 141, "Dark Souls II", "Black Desert Online", "Dragon's Dogma: Dark Arisen"], "game_id": "Dragon's Dogma: Dark Arisen", "afk_at": "2016/01/24 23:52:05", "id": "48162082507456512", "aliases": []}, "marion": {"status": "offline", "is_afk": false, "status_change_at": "2015/12/03 05:14:48", "prev_status": "online", "games_played": [1, null], "game_id": null, "afk_at": "2015/12/02 08:30:16"}, "shyrith": {"status": "offline", "is_afk": false, "status_change_at": "2015/12/03 08:10:52", "prev_status": "online", "games_played": [1, 644, null], "game_id": null, "afk_at": "2015/12/02 21:54:35"}, "hiimapirate": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/12 05:08:57", "mention": "<@133758935009198080>", "prev_status": "online", "games_played": [], "game_id": null, "afk_at": "2015/12/20 11:34:43", "id": "133758935009198080", "aliases": []}, "az": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/23 06:17:41", "mention": "<@127330097949573121>", "prev_status": "online", "games_played": [], "game_id": null, "afk_at": "2015/12/19 06:10:40", "id": "127330097949573121", "aliases": []}, "yung_thirsty": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/24 08:36:17", "mention": "<@136368619423531008>", "prev_status": "online", "games_played": ["League of Legends", "Amnesia: The Dark Descent", "Clicker Heroes", "Crusader Kings II"], "game_id": "League of Legends", "afk_at": "2016/01/12 07:22:37", "id": "136368619423531008", "aliases": []}, "goshzilla": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 22:31:01", "mention": "<@47934670406422528>", "prev_status": "idle", "game_id": "Monster Hunter Online", "games_played": [3, null, 6, 7, 777, "League of Legends", "Monster Hunter Online"], "afk_at": "2016/01/24 22:08:02", "id": "47934670406422528", "aliases": []}, "herbeh": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/11 10:46:35", "mention": "<@105392869782622208>", "prev_status": "online", "game_id": null, "games_played": [], "afk_at": "2016/01/11 08:46:57", "id": "105392869782622208", "aliases": []}, "eeri": {"status": "offline", "is_afk": false, "status_change_at": "2015/12/15 06:31:49", "mention": "<@122023217371021313>", "prev_status": "online", "game_id": null, "games_played": [659, null], "afk_at": "2015/12/15 06:09:09", "id": "122023217371021313", "aliases": []}, "dick": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 22:39:52", "mention": "<@78767611436863488>", "prev_status": "online", "games_played": [372, null, 1, 488, "Dark Souls", "Metal Gear Solid V: The Phantom Pain", "Phantasy Star Online 2", "Black Desert Online"], "game_id": null, "afk_at": "2016/01/24 22:39:52", "id": "78767611436863488", "aliases": []}, "arka": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 23:44:00", "mention": "<@121466618126532608>", "prev_status": "offline", "games_played": [1, null, 313, 488, "FINAL FANTASY XIV"], "game_id": null, "afk_at": "2016/01/24 23:03:26", "id": "121466618126532608", "aliases": []}, "wriggle": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/16 19:20:41", "mention": "<@80169354666192896>", "prev_status": "online", "games_played": [], "game_id": null, "afk_at": "2015/12/02 15:37:49", "id": "80169354666192896", "aliases": []}, "tim": {"status": "offline", "is_afk": false, "status_change_at": "2015/12/04 10:25:19", "mention": "<@109145030354030592>", "prev_status": "online", "game_id": null, "games_played": [], "afk_at": "2015/12/04 07:08:23", "id": "109145030354030592"}, "charisma": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 22:42:31", "mention": "<@65187139276513280>", "prev_status": "idle", "game_id": "Dragon's Dogma: Dark Arisen", "games_played": [313, null, 807, 471, 671, 728, 0, "Sony Playstation Emulator", "Black Desert Online", "Dragon's Dogma: Dark Arisen"], "afk_at": "2016/01/24 22:42:11", "id": "65187139276513280", "aliases": []}, "mate": {"status": "offline", "is_afk": false, "status_change_at": "2015/12/04 09:11:30", "mention": "<@109145154044071936>", "prev_status": "online", "game_id": null, "games_played": [], "afk_at": "2015/12/04 05:06:58", "id": "109145154044071936"}, "sig": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/23 13:11:50", "mention": "<@104055037243707392>", "prev_status": "online", "games_played": [8, null, 7, 466, 588, 15, 6, 13, 165, 669, 101, "Diablo 3", "Tabletop Simulator", "DOTA 2", "Crusader Kings II"], "game_id": "DOTA 2", "afk_at": "2016/01/23 05:03:03", "id": "104055037243707392", "aliases": []}, "bunta": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 22:24:40", "mention": "<@122520378089275395>", "prev_status": "online", "game_id": null, "games_played": [488, null], "afk_at": "2016/01/24 22:24:40", "id": "122520378089275395", "aliases": []}, "mr. nelson": {"status": "offline", "is_afk": false, "status_change_at": "2015/12/14 13:35:09", "mention": "<@103311664748707840>", "prev_status": "online", "game_id": null, "games_played": [], "afk_at": "2015/12/14 10:25:27", "id": "103311664748707840", "aliases": []}, "草 goshzilla": {"status": "online", "is_afk": false, "status_change_at": "2016/01/15 15:28:19", "mention": "<@47934670406422528>", "prev_status": "offline", "game_id": null, "games_played": [], "afk_at": "2016/01/15 08:23:14", "id": "47934670406422528", "aliases": []}, "skeletonhorn": {"status": "online", "is_afk": false, "status_change_at": "2015/12/03 00:36:39", "prev_status": "offline", "games_played": [], "game_id": null, "afk_at": "2015/12/03 00:36:39"}, "yoltan": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/08 23:38:09", "mention": "<@122369674808786948>", "prev_status": "online", "games_played": [238, null, 307], "game_id": null, "afk_at": "2015/12/04 16:14:00", "id": "122369674808786948", "aliases": []}, "rui": {"status": "offline", "is_afk": false, "status_change_at": "2016/01/24 23:35:21", "mention": "<@63649222993391616>", "prev_status": "online", "games_played": [174, null, 660, 724, 488, 149, 780, 301, 438, 140, 680, "Grand Theft Auto V", "Dragon's Dogma: Dark Arisen"], "game_id": "Grand Theft Auto V", "afk_at": "2016/01/24 23:17:25", "id": "63649222993391616", "aliases": []}, "adol": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 15:58:19", "mention": "<@122079633796497409>", "prev_status": "idle", "games_played": [550, null, 1, "Black Desert Online", "Clicker Heroes"], "game_id": "Clicker Heroes", "afk_at": "2016/01/24 15:57:49", "id": "122079633796497409", "aliases": []}, "xorfos": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 22:35:29", "mention": "<@121019458700443650>", "prev_status": "online", "game_id": null, "games_played": [430, null, 550, 140, "Dwarf Fortress", "Tales of Zestiria", "Cook, Serve, Delicious!"], "afk_at": "2016/01/24 22:35:29", "id": "121019458700443650", "aliases": []}, "roris": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 22:58:35", "mention": "<@80876422352076800>", "prev_status": "online", "game_id": "Dragon's Dogma: Dark Arisen", "games_played": [1, null, 0, 658, 345, 724, 471, 269, 307, "Grandia 2", "Black Desert Online", "Dragon's Dogma: Dark Arisen"], "afk_at": "2016/01/24 22:58:35", "id": "80876422352076800", "aliases": []}, "projectaria": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 20:40:15", "mention": "<@48146724769763328>", "prev_status": "online", "game_id": null, "games_played": [1, null, "Nintendo Emulator"], "afk_at": "2016/01/24 20:40:15", "id": "48146724769763328", "aliases": []}, "moss": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 22:43:58", "mention": "<@48168872238387200>", "prev_status": "idle", "games_played": [0, null, 1, 715, 127, 206, 440], "game_id": null, "afk_at": "2016/01/24 22:35:08", "id": "48168872238387200", "aliases": []}, "master of moisture": {"status": "offline", "is_afk": false, "status_change_at": "2015/12/20 10:57:33", "mention": "<@112340697771765760>", "prev_status": "idle", "game_id": null, "games_played": [], "afk_at": "2015/12/20 10:52:58", "id": "112340697771765760", "aliases": []}, "hellsbreath:skull:": {"status": "online", "is_afk": false, "status_change_at": "2015/12/10 15:13:36", "mention": "<@78767557628133376>", "prev_status": "offline", "games_played": [], "game_id": null, "afk_at": "2015/12/10 15:13:36", "id": "78767557628133376", "aliases": []}, "hellsbreath :skull:": {"status": "online", "is_afk": false, "status_change_at": "2015/12/10 15:13:50", "mention": "<@78767557628133376>", "prev_status": "offline", "game_id": null, "games_played": [], "afk_at": "2015/12/10 15:13:50", "id": "78767557628133376", "aliases": []}, "yobi": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 20:05:45", "mention": "<@65180855919714304>", "prev_status": "idle", "games_played": [3, null, 680, 379, "Unity", "World of Warcraft"], "game_id": null, "afk_at": "2016/01/24 19:55:05", "id": "65180855919714304", "aliases": []}, "salt": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 21:52:01", "mention": "<@48140539459010560>", "prev_status": "offline", "game_id": null, "games_played": [466, 8, null, 680, 588, 15, 512, 260, "Hearthstone", "Tabletop Simulator", "Crusader Kings II"], "afk_at": "2016/01/24 11:15:21", "id": "48140539459010560", "aliases": []}, "study": {"status": "online", "mention": "<@121821978222002178>", "is_afk": false, "games_played": ["FINAL FANTASY XIV", "Rocket League", "Dragon's Dogma: Dark Arisen", null], "game_id": "Dragon's Dogma: Dark Arisen", "afk_at": "2016/01/24 10:24:35", "status_change_at": "2016/01/24 23:41:56", "id": "121821978222002178", "prev_status": "offline", "aliases": []}, "草 goshzilla 一角": {"status": "online", "is_afk": false, "status_change_at": "2016/01/17 18:31:46", "mention": "<@47934670406422528>", "prev_status": "idle", "game_id": "League of Legends", "games_played": ["League of Legends"], "afk_at": "2016/01/17 18:27:26", "id": "47934670406422528", "aliases": []}, "grey": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 19:25:55", "mention": "<@48120346410221568>", "prev_status": "offline", "games_played": [550, null, 1, 208, 283, 318, "Counter-Strike: Global Offensive", "FINAL FANTASY XIV", "Skyforge", "Dark Souls II", "Crypt of the NecroDancer", "", "Rocket League", "Dragon's Dogma: Dark Arisen"], "game_id": "Dragon's Dogma: Dark Arisen", "afk_at": "2016/01/24 15:28:16", "id": "48120346410221568", "aliases": []}, "hellsbreath": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 23:32:44", "mention": "<@78767557628133376>", "prev_status": "offline", "games_played": [326, null, 660, 680, 566, 441, 363, 488, 246, "The Last Remnant", "Phantasy Star Online 2", "FINAL FANTASY XI", "Rainbow Six Siege", "Tales of Zestiria", "SolForge", "Fallout 4", "Wolfenstein.The.New.Order", "King's Quest"], "game_id": null, "afk_at": "2016/01/24 19:58:40", "id": "78767557628133376", "aliases": ["Barry", "Ben Killin", "Hellsbreath", "Barry", "Ben Killin"]}, "green": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 23:04:39", "mention": "<@63098846506397696>", "prev_status": "offline", "game_id": null, "games_played": [4, null, 3, 11, "League of Legends"], "afk_at": "2016/01/24 06:50:07", "id": "63098846506397696", "aliases": []}, "azia": {"status": "idle", "is_afk": true, "status_change_at": "2016/01/24 18:56:35", "mention": "<@121404665727418368>", "prev_status": "online", "games_played": ["Dragon's Dogma: Dark Arisen", null], "game_id": null, "afk_at": "2016/01/24 18:56:35", "id": "121404665727418368", "aliases": []}, "scoops": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 18:58:15", "mention": "<@65211875771559936>", "prev_status": "offline", "games_played": [347, null, 0, 644, 308, 15, 3, 306, 351, "Counter-Strike: Global Offensive", "Rocket League"], "game_id": null, "afk_at": "2016/01/23 19:28:16", "id": "65211875771559936", "aliases": []}, "richter": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 22:41:52", "mention": "<@49237234515181568>", "prev_status": "idle", "game_id": null, "games_played": [488, null, 183, 11], "afk_at": "2016/01/24 22:36:41", "id": "49237234515181568", "aliases": []}, "cae": {"status": "online", "is_afk": false, "status_change_at": "2016/01/24 21:27:13", "mention": "<@65178683714830336>", "prev_status": "idle", "games_played": [335, null, 215, 112, 274, 443, "Undertale"], "game_id": null, "afk_at": "2016/01/24 21:13:13", "id": "65178683714830336", "aliases": []}}
\ No newline at end of file
......