'Edit' => 'š'
];
+ $shit = explode(' ', $arguments);
+
+ $hsname = $shit[0];
+ $page = $shit[1] ?? 1;
+
$songHashMap = unserialize(file_get_contents(__DIR__ . '/hashmap.txt'));
$scoreFiles = foldMap(ā(ā(lhead)(null), 'file_get_contents'))(glob(PATH_TO_GROOVENET . '/*.scores.txt'));
);
$asdf = prefixKey('', $scoreTesseract);
+ uksort($asdf, function($a, $b) use ($songHashMap) {
+ $a = explode('/', $songHashMap[explode('.', $a)[0]])[1];
+ $b = explode('/', $songHashMap[explode('.', $b)[0]])[1];
+
+ return strcmp($a, $b);
+ });
$pranks = [];
foreach ($asdf as $k => $v) {
$k = explode('.', $k);
- if ($k[3] !== $arguments) {
+ if ($k[3] !== $hsname) {
continue;
}
if (!$pranks) {
$this->replyWithMessage(
[
- 'text' => "$arguments doesn't have any scores."
+ 'text' => "$hsname doesn't have any scores."
]
);
return;
}
+ $chunky = array_chunk($pranks, 10);
+ if (!isset($chunky[$page-1])) {
+ $this->replyWithMessage(['text' => 'Invalid page number: ' . $page . "\nQuery without a page number to see the valid range."]);
+ return;
+ }
+
+ $pranks = $chunky[$page - 1];
$numE = count($pranks);
- $pranks[$numE- 1] .= "\nāāāāāāāāāāāāāā";
+ $pranks[$numE-1] .= "\nāāāāāāāāāāāāāā";
+
+ $extra = count($chunky) > 1 ? " (page $page of " . count($chunky) . ")" : '';
+
$chatid = getTelegram()->getWebhookUpdates()->get('message')->get('chat')->get('id');
getTelegram()->sendMessage(
[
'chat_id' => $chatid,
'parse_mode' => 'Markdown',
- 'text' => "High scores for $arguments ...\n\n```" . unlines($pranks) . "```"
+ 'text' => "High scores for $hsname"."$extra ...\n\n```\n" . unlines($pranks) . "```"
]
);
}