diff --git a/ripple/userUtils.py b/ripple/userUtils.py index 8f2f0b8..2ed4bc2 100644 --- a/ripple/userUtils.py +++ b/ripple/userUtils.py @@ -1648,3 +1648,15 @@ def updateAchievementsVersion(userID): glob.db.execute("UPDATE users SET achievements_version = %s WHERE id = %s LIMIT 1", [ glob.ACHIEVEMENTS_VERSION, userID ]) + +def getClan(userID): + """ + Get userID's clan + :param userID: user id + :return: username or None + """ + clanInfo = glob.db.fetch("SELECT clans.tag, clans.id, user_clans.clan, user_clans.user FROM user_clans LEFT JOIN clans ON clans.id = user_clans.clan WHERE user_clans.user = %s LIMIT 1", [userID]) + username = getUsername(userID) + if clanInfo is None: + return username + return "[" + clanInfo["tag"] + "] " + username \ No newline at end of file