!752 static O mainBot; p { load("UserPostCounts"); } public static new Map UserPostCounts; public static String LevelUp() { String username = cast callOpt(mainBot, "getUserName"); if (empty(username)) ret null; if (UserPostCounts.containsKey(username)) { UserPostCounts.put(username, UserPostCounts.get(username)+1); save("UserPostCounts"); S word = "coder maniac"; switch (UserPostCounts.get(username).intValue()) { case 10: return "Level up! " + username + " is now a level 2 " + word +"!"; case 100: return "Level up! " + username + " is now a level 3 " + word +"!"; case 500: return "Level up! " + username + " is now a level 4 " + word +"!"; case 1000: return "Level up! " + username + " is now a level 5 " + word +"!"; case 5000: return "Level up! " + username + " is now a level 6 " + word +"!"; } } else { UserPostCounts.put(username, 1L); save("UserPostCounts"); } return ""; } public static String ViewLevel(S s) { new Matches m; String returnString = ""; if (match("!level *", s, m)) { String username = m.unq(0); long postCount = 0; if (UserPostCounts.containsKey(username)) { postCount = UserPostCounts.get(username); } else { return username + " has no posts"; } returnString = username + " is level "; if (postCount < 10) { returnString += "1"; } else if (postCount >= 10 && postCount < 100) { returnString += "2"; } else if (postCount >= 100 && postCount < 500) { returnString += "3"; } else if (postCount >= 500 && postCount < 1000) { returnString += "4"; } else if (postCount >= 1000 && postCount < 5000) { returnString += "5"; } else { returnString += "6"; } returnString += " with " + postCount + " posts."; } return returnString; } static synchronized S answer(S s) { S a = ViewLevel(s); if (!empty(a)) ret a; ret LevelUp(); }