Closed yaroslavpopovic closed 1 year ago
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
As for version 3.1
A path to local file, a URL, or a file resource should be uploaded using Telegram\Bot\FileUpload\InputFile::create($pathOrUrlOrResource, $filename)
for document
property.
I use version 3.4 and this is my code to send a file. Thanks @marechenok.
use Telegram\Bot\FileUpload\InputFile;
...
public function handle()
{
$response = $this->getUpdate();
$chat_id = $response->getChat()->getId();
$filename = 'students.xlsx';
$pathOrUrlOrResource = public_path('files/students/' . $filename);
$inputFile = InputFile::create($pathOrUrlOrResource, $filename);
$response = $this->telegram->sendDocument([
'chat_id' => $chat_id,
'document' => $inputFile
]);
}
It works!
Hi, I'm trying to reply by sending a document with the method replyWithDocument but it does not work. With the method replyWithMessage I have no problem
`<?php namespace App\TelegramCommands; use Illuminate\Support\Facades\Storage; use Telegram\Bot\Commands\Command; use Telegram\Bot\Laravel\Facades\Telegram;
class PdfListCommand extends Command { /**
@var string Command Name */ protected $name = "plist";
/**
@var string Command Description */ protected $description = "Scarica il file in pdf delle ultime richieste ricevute";
/**
@inheritdoc */ public function handle($arguments) { $fileName = uniqid(); $pdf = app('dompdf'); $pdf->loadHTML('
Tesdddddddddt
'); Storage::disk('public')->put($fileName.'.pdf', $pdf->output());} }`