osu commands changed a bit
This commit is contained in:
parent
1f46f40be1
commit
0418cfba19
@ -16,8 +16,8 @@ namespace NadekoBot.Modules.Searches.Commands
|
|||||||
|
|
||||||
internal override void Init(CommandGroupBuilder cgb)
|
internal override void Init(CommandGroupBuilder cgb)
|
||||||
{
|
{
|
||||||
cgb.CreateCommand(Module.Prefix + "osu u")
|
cgb.CreateCommand(Module.Prefix + "osu")
|
||||||
.Description("Shows osu stats for a player.\n**Usage**:~osu u Name")
|
.Description("Shows osu stats for a player.\n**Usage**: `~osu Name` or `~osu Name `")
|
||||||
.Parameter("usr", ParameterType.Required)
|
.Parameter("usr", ParameterType.Required)
|
||||||
.Parameter("mode", ParameterType.Unparsed)
|
.Parameter("mode", ParameterType.Unparsed)
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
@ -115,9 +115,7 @@ namespace NadekoBot.Modules.Searches.Commands
|
|||||||
|
|
||||||
var reqString = $"https://osu.ppy.sh/api/get_user_best?k={NadekoBot.Creds.OsuAPIKey}&u={Uri.EscapeDataString(e.GetArg("usr"))}&type=string&limit=5&m={m}";
|
var reqString = $"https://osu.ppy.sh/api/get_user_best?k={NadekoBot.Creds.OsuAPIKey}&u={Uri.EscapeDataString(e.GetArg("usr"))}&type=string&limit=5&m={m}";
|
||||||
var obj = JArray.Parse(await SearchHelper.GetResponseStringAsync(reqString).ConfigureAwait(false));
|
var obj = JArray.Parse(await SearchHelper.GetResponseStringAsync(reqString).ConfigureAwait(false));
|
||||||
var sb = new System.Text.StringBuilder();
|
var sb = new System.Text.StringBuilder($"`Top 5 plays for {e.GetArg("usr")}:`\n```xl" + Environment.NewLine);
|
||||||
sb.AppendLine($"Top 5 plays for {e.GetArg("usr")}:");
|
|
||||||
sb.AppendLine("");
|
|
||||||
foreach (var item in obj)
|
foreach (var item in obj)
|
||||||
{
|
{
|
||||||
var mapReqString = $"https://osu.ppy.sh/api/get_beatmaps?k={NadekoBot.Creds.OsuAPIKey}&b={item["beatmap_id"]}";
|
var mapReqString = $"https://osu.ppy.sh/api/get_beatmaps?k={NadekoBot.Creds.OsuAPIKey}&b={item["beatmap_id"]}";
|
||||||
@ -126,10 +124,11 @@ namespace NadekoBot.Modules.Searches.Commands
|
|||||||
var acc = CalculateAcc(item, m);
|
var acc = CalculateAcc(item, m);
|
||||||
var mods = ResolveMods(Int32.Parse($"{item["enabled_mods"]}"));
|
var mods = ResolveMods(Int32.Parse($"{item["enabled_mods"]}"));
|
||||||
if (mods != "+")
|
if (mods != "+")
|
||||||
sb.AppendLine($"{pp}pp | {acc}% | {map["artist"]} - {map["title"]} ({map["version"]}) **{mods}** | /b/{item["beatmap_id"]}");
|
sb.AppendLine($"{pp + "pp",-7} | {acc + "%",-7} | {map["artist"] + "-" + map["title"] + " (" + map["version"],-40}) | **{mods,-10}** | /b/{item["beatmap_id"]}");
|
||||||
else
|
else
|
||||||
sb.AppendLine($"{pp}pp | {acc}% | {map["artist"]} - {map["title"]} ({map["version"]}) | /b/{item["beatmap_id"]}");
|
sb.AppendLine($"{pp + "pp",-7} | {acc + "%",-7} | {map["artist"] + "-" + map["title"] + " (" + map["version"],-40}) | /b/{item["beatmap_id"]}");
|
||||||
}
|
}
|
||||||
|
sb.Append("```");
|
||||||
await e.Channel.SendMessage(sb.ToString()).ConfigureAwait(false);
|
await e.Channel.SendMessage(sb.ToString()).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
Loading…
Reference in New Issue
Block a user