1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-26 21:34:41 +01:00
This commit is contained in:
Daniil Gentili 2023-11-25 20:20:23 +01:00
parent b3eb9e9243
commit 9ec2f619b7
2 changed files with 11 additions and 9 deletions

2
docs

@ -1 +1 @@
Subproject commit b1968e08ee33430f535100e7dd9c1e1f8bc9a2bb
Subproject commit 1e38683e7f0464c86cb5084c360dc1753b28d130

View File

@ -136,16 +136,18 @@ final class StoriesEventHandler extends SimpleEventHandler
// Sort by date
usort($stories, static fn ($a, $b) => $a['date'] <=> $b['date']);
$result = "Total stories: ".count($stories)."\n\n";
foreach ($stories as $story) {
$cur = "- ID {$story['id']}, posted ".date(DATE_RFC850, $story['date']);
if (isset($story['caption'])) {
$cur .= ', "'.self::markdownEscape($story['caption']).'"';
$message = $message->reply("Total stories: ".count($stories));
foreach (array_chunk($stories, 50) as $sub) {
$result = '';
foreach ($sub as $story) {
$cur = "- ID {$story['id']}, posted ".date(DATE_RFC850, $story['date']);
if (isset($story['caption'])) {
$cur .= ', "'.self::markdownEscape($story['caption']).'"';
}
$result .= "$cur; [click here to download »]({$this->userInstance->getDownloadLink($story)})\n";
}
$result .= "$cur; [click here to download »]({$this->userInstance->getDownloadLink($story)})\n";
$message = $message->reply($result, parseMode: ParseMode::MARKDOWN);
}
$message->reply($result, parseMode: ParseMode::MARKDOWN);
}
}