getTelegram()->addCommand(
new class extends Command {
- protected $name = 'hashgen';
- protected $description = 'Generate the songs hash';
+ protected $name = 'updatehashes';
+ protected $description = 'Update the songs hash list (should be reasonably fast)';
public function handle($arguments) {
if (file_exists('/tmp/gnb.lock')) {
}
$this->replyWithMessage(
[
- 'text' => "Building songs hash list... This will take a while."
+ 'text' => "Updating songs hash list... This could take a while, hopefully not though."
]
);
$chatid = getTelegram()->getWebhookUpdates()->get('message')->get('chat')->get('id');
- exec('/opt/hashgen.sh notify ' . $chatid . ' > /dev/null &');
+ exec('/opt/fasthashgen.sh notify ' . $chatid . ' > /dev/null &');
}
}
);
+getTelegram()->addCommand(
+ new class extends Command {
+ protected $name = 'regeneratehashes';
+ protected $description = 'Completely regenerate the songs hash list';
+
+ public function handle($arguments) {
+ if (file_exists('/tmp/gnb.lock')) {
+ $this->replyWithMessage(
+ [
+ 'text' => "Rebuild currently in progress, try again after it is complete."
+ ]
+ );
+
+ return;
+ }
+ $this->replyWithMessage(
+ [
+ 'text' => "Rebuilding songs hash list... This will take a while."
+ ]
+ );
+ $chatid = getTelegram()->getWebhookUpdates()->get('message')->get('chat')->get('id');
+
+ exec('/opt/hashgen.sh notify ' . $chatid . ' > /dev/null &');
+ }
+ }
+);
getTelegram()->commandsHandler(true); //must come afterwards because lolzer