osu.js
osu.js copied to clipboard
`beatmaps.getBeatmapAttributes` return the wrong value from the osu.js docs (and type declaration).
beatmaps.getBeatmapAttributes return
{
attributes : OsuBeatmapDifficultyAttributes | TaikoBeatmapDifficultyAttributes | FruitsBeatmapDifficultyAttributes | ManiaBeatmapDifficultyAttributes
}
instead of
OsuBeatmapDifficultyAttributes | TaikoBeatmapDifficultyAttributes | FruitsBeatmapDifficultyAttributes | ManiaBeatmapDifficultyAttributes
itself
Which accurate to https://osu.ppy.sh/docs/index.html#get-beatmap-attributes
But the docs and type declaration said it return the items inside attributes
Example return body from this map with DT on osu
{
"attributes":
{
"star_rating":6.30925989151001,
"max_combo":1201,
"aim_difficulty":2.8903698921203613,
"speed_difficulty":3.13742995262146,
"speed_note_count":271.9110107421875,
"flashlight_difficulty":0,"slider_factor":0.9784319996833801,
"approach_rate":10.33329963684082,
"overall_difficulty":9.111109733581543
}
}
current workaround for 2.4.0
You should explicitly cast return result as any or {attributes: OsuBeatmapDifficultyAttributes | TaikoBeatmapDifficultyAttributes | FruitsBeatmapDifficultyAttributes | ManiaBeatmapDifficultyAttributes} then get attributes value from the result instead
const beatmapAttributes = (await client.beatmaps.getBeatmapAttributes(
id,
mode,
{ body: { mods } }
)) as any
return beatmapAttributes.attributes