def eventAchievement(data): time, name, ach = data q.put(("INSERT INTO achievements VALUES (?,?,?)", (datetime.datetime.now(), name, ach))) vanillabean.tweet('{} just got "{}"'.format(name, ach))
def playtimeStat(): top = dbQuery(dbfile, 30, ( 'select count(getStat(stats, "stat.playOneMinute")) as total, name from playeractivity natural join playerUUID where datetime >= datetime("now", "-7 days") group by name order by total desc limit 1', ))[0] vanillabean.tweet( "Congrats to {} for playing {} minutes this week!".format( top[1], str(top[0])))
def eventAchievement(data): time, name, ach = data conn = sqlite3.connect(dbfile) cur = conn.cursor() q.put(("INSERT INTO achievements VALUES (?,?,?)", (datetime.datetime.now(), name, ach))) vanillabean.tweet('{} just got "{}"'.format(name, ach)) conn.commit() conn.close()
def playtimeStat(): def getStat(stats, stat): return eval(stats).get(stat,0) conn = sqlite3.connect(dbfile) conn.create_function("getStat", 2, getStat) cur = conn.cursor() cur.execute('select count(getStat(stats, "stat.playOneMinute")) as total, name from stats natural join playerUUID where datetime >= datetime("now", "-7 days") group by name order by total desc limit 1') top = cur.fetchall()[0] conn.commit() conn.close() vanillabean.tweet("Congrats to {} for playing {} minutes this week!".format(top[1], str(top[0])))
def sneakStat(): name, stat = stats("stat.sneakTime") vanillabean.tweet("Congrats to {} for sneaking {} m this week!".format(name, stat / 100 ))
def minecartStat(): name, stat = stats("stat.minecartOneCm") vanillabean.tweet("Congrats to {} for sitting in a minecart for {} m this week!".format(name, stat / 100 ))
def flyStat(): name, stat = stats("stat.aviateOneCm") vanillabean.tweet("Congrats to {} for flying {} kms this week!".format(name, stat / 100 / 1000))
def boatStat(): name, stat = stats("stat.boatOneCm") vanillabean.tweet("Congrats to {} for boating {} m this week!".format(name, stat / 100 ))
def boatStat(): name, stat = stats("stat.boatOneCm") vanillabean.tweet("Congrats to {} for boating {} m this week!".format( name, stat / 100))
def sneakStat(): name, stat = stats("stat.sneakTime") vanillabean.tweet("Congrats to {} for sneaking {} m this week!".format( name, stat / 100))
def minecartStat(): name, stat = stats("stat.minecartOneCm") vanillabean.tweet( "Congrats to {} for sitting in a minecart for {} m this week!".format( name, stat / 100))
def flyStat(): name, stat = stats("stat.aviateOneCm") vanillabean.tweet("Congrats to {} for flying {} kms this week!".format( name, stat / 100 / 1000))