getTelegram()->addCommand(
new class extends Command {
+ protected $name = 'faves';
+ protected $description = 'List favourites';
+
+ public function handle($arguments) {
+ $faveFiles = foldMap(☐(null)(∘(lines, 'trim', 'file_get_contents')))(glob(PATH_TO_GROOVENET . '/*.favourites.txt'));
+ $names = map(☐(produceValue(0))(null))(array_keys($faveFiles));
+ $hashes = map(map(☐(produceValue(0))(null)))(array_values($faveFiles));
+ $songHashMap = unserialize(file_get_contents(__DIR__ . '/hashmap.txt'));
+ $faveMap = ∘(map(∘(flip(concat)("'s Faves"), 'ucwords', field(0), delemit('.'), 'basename')), foldMap(☐(field(1))(field(0))), foldMap(id))(zzipWith(∘(map, aaray_merge))($names)($hashes));
+ $newFaves = zzipWith(∘(concat, flip(concat)(" in "), flip(field)($songHashMap)))(array_keys($faveMap))(array_values($faveMap));
+ $this->replyWithMessage(
+ [
+ 'text' => unlines($newFaves)
+ ]
+ );
+ }
+ }
+);
+
+getTelegram()->addCommand(
+ new class extends Command {
protected $name = 'scores';
protected $description = 'Get all scores with specified high score name';