public async Task Test(params string[] userIds) { if (IsAdmin()) { var reply = string.Empty; foreach (var x in userIds) { string userId = x; //Sanitize input if (userId.StartsWith("https://scoresaber.com/u/")) { userId = userId.Substring("https://scoresaber.com/u/".Length); } if (userId.Contains("&")) { userId = userId.Substring(0, userId.IndexOf("&")); } userId = Regex.Replace(userId, "[^0-9]", ""); var basicData = await ScoresaberService.GetBasicPlayerData(userId); var countryCode = ScoresaberService.GetPlayerCountry(basicData); var countryName = new RegionInfo(countryCode).EnglishName; Logger.Debug(countryName); reply += $"\'{countryName}\', "; } await ReplyAsync(reply); } }
public static void CreateCommunitiyButton() { try { if (ReflectionUtil.ListLoadedAssemblies().Any(x => x.GetName().Name == "SongCore")) { #if TEAMSABER var buttonName = "Team Saber"; var hint = "Compete with your team in the competition!"; #elif DISCORDCOMMUNITY var buttonName = "Discord Community"; var hint = "Compete with your team in the competition!"; #elif TRUEACCURACY var buttonName = "True Accuracy Tournament"; var hint = "Show off your skills!"; #elif ASIAVR var buttonName = "AsiaVR Tournament"; var hint = "Compete in the Asia Server Event!"; #elif BTH var buttonName = "BTH Qualifiers"; var hint = "Qualifier plugin for Beat the Hub!"; #elif QUALIFIER var buttonName = "WC Qualifiers"; var hint = "Qualifier menu for Beat Saber World Cup"; #elif BEATKHANA var buttonName = "BeatKhana Qualifiers"; var hint = "Qualifier Plugin for BeatKhana"; #else var buttonName = "EVENT BETA"; var hint = "STILL A BETA"; #endif _communityButton = new MenuButton(buttonName, hint, CommunityButtonPressed); _communityButton.Interactable = Loader.AreSongsLoaded; MenuButtons.instance.RegisterButton(_communityButton); Loader.SongsLoadedEvent += SongsLoaded; } else { Logger.Error("MISSING SONGCORE PLUGIN"); } } catch (Exception e) { Logger.Error("Error: " + e.Message); Logger.Error(e.StackTrace); } }