.ADD. .BANCHO. Add stars to !last and use mods in star calculation for tillerino
This commit is contained in:
parent
3c0dd56df5
commit
b5806bdfbf
|
@ -321,7 +321,7 @@ def systemStatus(fro, chan, message):
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
|
||||||
def getPPMessage(userID):
|
def getPPMessage(userID, just_data = False):
|
||||||
try:
|
try:
|
||||||
# Get user token
|
# Get user token
|
||||||
token = glob.tokens.getTokenFromUserID(userID)
|
token = glob.tokens.getTokenFromUserID(userID)
|
||||||
|
@ -343,6 +343,9 @@ def getPPMessage(userID):
|
||||||
else:
|
else:
|
||||||
raise exceptions.apiException
|
raise exceptions.apiException
|
||||||
|
|
||||||
|
if just_data:
|
||||||
|
return data
|
||||||
|
|
||||||
# Return response in chat
|
# Return response in chat
|
||||||
# Song name and mods
|
# Song name and mods
|
||||||
msg = "{song}{plus}{mods} ".format(song=data["song_name"], plus="+" if token.tillerino[1] > 0 else "", mods=generalFunctions.readableMods(token.tillerino[1]))
|
msg = "{song}{plus}{mods} ".format(song=data["song_name"], plus="+" if token.tillerino[1] > 0 else "", mods=generalFunctions.readableMods(token.tillerino[1]))
|
||||||
|
@ -482,7 +485,7 @@ def tillerinoAcc(fro, chan, message):
|
||||||
def tillerinoLast(fro, chan, message):
|
def tillerinoLast(fro, chan, message):
|
||||||
try:
|
try:
|
||||||
data = glob.db.fetch("""SELECT beatmaps.song_name as sn, scores.*,
|
data = glob.db.fetch("""SELECT beatmaps.song_name as sn, scores.*,
|
||||||
beatmaps.beatmap_id as bid
|
beatmaps.beatmap_id as bid, beatmaps.difficulty
|
||||||
FROM scores
|
FROM scores
|
||||||
LEFT JOIN beatmaps ON beatmaps.beatmap_md5=scores.beatmap_md5
|
LEFT JOIN beatmaps ON beatmaps.beatmap_md5=scores.beatmap_md5
|
||||||
LEFT JOIN users ON users.id = scores.userid
|
LEFT JOIN users ON users.id = scores.userid
|
||||||
|
@ -499,9 +502,23 @@ def tillerinoLast(fro, chan, message):
|
||||||
msg += " on " if chan == "FokaBot" else " | {0} on ".format(fro)
|
msg += " on " if chan == "FokaBot" else " | {0} on ".format(fro)
|
||||||
msg += "[http://osu.ppy.sh/b/{1} {0}]".format(data["sn"], data["bid"])
|
msg += "[http://osu.ppy.sh/b/{1} {0}]".format(data["sn"], data["bid"])
|
||||||
|
|
||||||
|
stars = data["difficulty"]
|
||||||
if data["mods"]:
|
if data["mods"]:
|
||||||
msg += ' +' + generalFunctions.readableMods(data["mods"])
|
msg += ' +' + generalFunctions.readableMods(data["mods"])
|
||||||
|
|
||||||
|
token = glob.tokens.getTokenFromUsername(fro)
|
||||||
|
if token == None:
|
||||||
|
return False
|
||||||
|
userID = token.userID
|
||||||
|
token.tillerino[0] = data["bid"]
|
||||||
|
token.tillerino[1] = data["mods"]
|
||||||
|
token.tillerino[2] = data["accuracy"]
|
||||||
|
oppaiData = getPPMessage(userID, just_data=True)
|
||||||
|
if "stars" in oppaiData:
|
||||||
|
stars = oppaiData["stars"]
|
||||||
|
|
||||||
msg += " ({0:.2f}%, {1})".format(data["accuracy"], rank.upper())
|
msg += " ({0:.2f}%, {1})".format(data["accuracy"], rank.upper())
|
||||||
|
msg += " | {0:.2f} stars".format(stars)
|
||||||
|
|
||||||
return msg
|
return msg
|
||||||
except Exception as a:
|
except Exception as a:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user