static void Main(string[] args) { string key = string.Empty; Console.WriteLine("input key"); while (key == string.Empty) { key = Console.ReadLine().Trim(); } var api = OsuApiClient.ClientUsingKey(key); //var beatmap = api.GetBeatmapsAsync(1441454).Result; //var recent = api.GetRecentlyAsync(6659067, Mode.Standard, 15).Result; //recent = api.GetRecentlyAsync("bleatingsheep", Mode.Standard, 17).Result; var best = api.GetBestPerformancesAsync(6659067, Mode.Taiko, 15).Result; //foreach (var item in best) //{ // double d = item.DoubleAccuracy; // decimal m = item.Accuracy; // Console.WriteLine(Math.Pow(d, 1024)); // Console.WriteLine(Math.Pow((double)m, 1024)); // for (int i = 0; i < 10; i++) // { // d *= d; // m *= m; // } // Console.WriteLine(d); // Console.WriteLine(m); //} best = api.GetBestPerformancesAsync("bleatingsheep", Mode.Mania, 17).Result; }
public static Message GetMusicMessage(OsuApiClient osuApi, BloodcatBeatmapSet set) { int setId = set.Id; string info = string.Empty; info += set.Beatmaps.Max(b => b.TotalLength) + "s, "; if (set.Beatmaps.Length > 1) { info += $"{set.Beatmaps.Min(b => b.Stars):0.##}* - {set.Beatmaps.Max(b => b.Stars):0.##}*"; } else { info += $"{set.Beatmaps.Single()?.Stars:0.##}*"; } // Creator and BPM info += "\r\n" + $"by {set.Creator}"; var bpms = set.Beatmaps.Select(b => b.Bpm).Distinct().ToList(); if (bpms.Count == 1) { info += $" ♩{bpms.First():#.##}"; } if (!string.IsNullOrEmpty(set.Source)) { info += "\r\n" + $"From {set.Source}"; } Message message = SendingMessage.MusicCustom(osuApi.PageOfSetOld(setId), osuApi.PreviewAudioOf(setId), $"{set.Title}/{set.Artist}", info, osuApi.ThumbOf(setId)); return(message); }
public static async Task <UserInfo> EnsureGetUserInfo(this OsuApiClient osuApi, string name, Bleatingsheep.Osu.Mode mode) { var(success, result) = await osuApi.GetUserInfoAsync(name, mode); ExecutingException.Ensure(success, "网络错误。"); ExecutingException.Ensure(result != null, "无此用户!"); return(result); }
public PerformancePlusUser( INewbieDatabase database, ILegacyDataProvider dataProvider, OsuApiClient osuApi, ILogger <PerformancePlusUser> logger) { Database = database; DataProvider = dataProvider; OsuApi = osuApi; _logger = logger; }
public static async Task <(bool, UserInfo)> GetCachedUserInfo(this OsuApiClient osuApi, int id, Bleatingsheep.Osu.Mode mode) { var hasCache = s_cache.TryGetValue <UserInfo>((id, mode), out var cachedInfo); if (hasCache) { return(true, cachedInfo); } var(success, userInfo) = await osuApi.GetUserInfoAsync(id, mode); if (success) { s_cache.Set((id, mode), userInfo, CacheAvailable); return(true, userInfo); } else { // fail return(default);
public OsuQqBot(IQqBot qqBot) { qq = qqBot; QqApi = qq; CurrentQq = qq.GetLoginQq(); Config config = JsonConvert.DeserializeObject <Config>(File.ReadAllText(Paths.JsonConfigPath)); id_Kamisama = config.Kamisama; IdWhoLovesInt100Best = id_Kamisama; GroupId = config.MainGroup; foreach (var item in config.ValidGroups) { ValidGroups.Add(item); } try { var ignoreLines = File.ReadAllLines(Paths.IgnoreListPath); if (ignoreLines.Length == 2) { ignoreList = JsonConvert.DeserializeObject <HashSet <long> >(ignoreLines[0]); ignorePPList = JsonConvert.DeserializeObject <HashSet <long> >(ignoreLines[1]); } } catch (FileNotFoundException) { } if (ignoreList == null) { ignoreList = new HashSet <long>(); } if (ignorePPList == null) { ignorePPList = new HashSet <long>(); } osuApiKey = config.ApiKey; apiClient = new OsuApiClient(config.ApiKey); qq.GroupAdminChange += OnGroupAdminChanged; qq.GroupMemberIncrease += OnGroupMemberIncreased; }
public static void SetApiKey(string apiKey) { OsuApi = OsuApiClient.ClientUsingKey(apiKey); s_osuApiFactory = OsuApiClientFactory.CreateFactory(apiKey); }
public Highlight(OsuApiClient osuApi, IDbContextFactory <NewbieContext> dbContextFactory) { OsuApi = osuApi; _dbContextFactory = dbContextFactory; }
public NewlyRankedBeatmapNotify(OsuApiClient osuApi) { OsuApi = osuApi; }