Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion bootstrap/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ private function sendTelegramChatFile($tchat, $fileData, $caption, $disableNotif
'chat_id' => $tchat->bot->group_chat_id,
'message_thread_id' => $tchat->tchat_id,
'parse_mode' => 'HTML',
$field => Longman\TelegramBot\Request::encodeFile($file->file_path_server)
$field => $this->getTelegramChatFileUrl($file)
);

if ($caption !== '') {
Expand Down Expand Up @@ -517,6 +517,20 @@ private function sendTelegramChatFile($tchat, $fileData, $caption, $disableNotif

return true;
}

private function getTelegramChatFileUrl($file)
{
$URLHash = '';

if ($file->chat_id > 0) {
$tsHash = time();
$temporaryHash = sha1($file->id . '_' . $file->hash . '_' . $tsHash . '_' . erConfigClassLhConfig::getInstance()->getSetting('site', 'secrethash'));
$URLHash = "/(vhash)/{$temporaryHash}/(vts)/{$tsHash}";
}

return erLhcoreClassSystem::getHost() . erLhcoreClassDesign::baseurldirect('file/downloadfile') . "/{$file->id}/{$file->security_hash}{$URLHash}";
}

public function messageAdded($params)
{
$chat = $params['chat'];
Expand Down