<commit_before>part of coUserver;

@app.Group("/elevation")
class Elevation {
	static Map<String, String> _cache = new Map();
	static Elevation INSTANCE = new Elevation();

	/// Used by client applications (game, forums, site, etc)
	@app.Route("/get/:username")
	Future<String> get(String username) async {
		if (_cache[username] != null) {
			return _cache[username];
		} else {
			List<User> rows = await dbConn.query(
				"SELECT elevation FROM users WHERE username = @username",
				User, {"username": username}
			);

			String elevationStr = rows.first.elevation ?? "";

			_cache[username] = elevationStr;
			return elevationStr;
		}
	}

	/// Used by Slack
	@app.Route("/set")
	Future<String> set(
		@app.QueryParam("token") String token,
		@app.QueryParam("channel_name") String channelName,
		@app.QueryParam("text") String text
	) async {
		if (token != slackPromoteToken) {
			return "Invalid token";
		}

		if (channelName != "administration") {
			return app.request.queryParameters.toString();
		}

		String elevation;
		String username;
		try {
			List<String> parts = text.split(" ");
			elevation = parts.first.trim();
			username = parts.sublist(1).join(" ");
		} catch(_) {
			return "Invalid parameters";
		}

		if (elevation == "none") {
			elevation = "";
		}

		int rows = await dbConn.execute(
			"UPDATE users SET elevation = @elevation WHERE username = @username",
			{"elevation": elevation, "username": username}
		);

		if (rows == 1) {
			_cache[username] = elevation;
			return "$username is now a $elevation";<commit_msg>Maybe it works now<commit_after>part of coUserver;

@app.Group("/elevation")
class Elevation {
	static Map<String, String> _cache = new Map();
	static Elevation INSTANCE = new Elevation();

	/// Used by client applications (game, forums, site, etc)
	@app.Route("/get/:username")
	Future<String> get(String username) async {
		if (_cache[username] != null) {
			return _cache[username];
		} else {
			List<User> rows = await dbConn.query(
				"SELECT elevation FROM users WHERE username = @username",
				User, {"username": username}
			);

			String elevationStr = rows.first.elevation ?? "";

			_cache[username] = elevationStr;
			return elevationStr;
		}
	}

	/// Used by Slack
	@app.Route("/set")
	Future<String> set(
		@app.QueryParam("token") String token,
		@app.QueryParam("channel_name") String channelName,
		@app.QueryParam("text") String text
	) async {
		if (token != slackPromoteToken) {
			return "Invalid token";
		}

		if (channelName != "G0277NLQS") {
			return "Run this from the administration group";
		}

		String elevation;
		String username;
		try {
			List<String> parts = text.split(" ");
			elevation = parts.first.trim();
			username = parts.sublist(1).join(" ");
		} catch(_) {
			return "Invalid parameters";
		}

		if (elevation == "none") {
			elevation = "";
		}

		int rows = await dbConn.execute(
			"UPDATE users SET elevation = @elevation WHERE username = @username",
			{"elevation": elevation, "username": username}
		);

		if (rows == 1) {
			_cache[username] = elevation;
			return "$username is now a $elevation";
{'fraction_non_alphanumeric': 0.1476833976833977, 'fraction_numerical': 0.002574002574002574, 'mean_word_length': 3.739329268292683, 'pattern_counts': {'":': 6, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7110365', 'n_tokens_mistral': 1153, 'n_tokens_neox': 970, 'n_words': 269}