core icon indicating copy to clipboard operation
core copied to clipboard

How to SendDocument on Conversation?

Open reactmorelab opened this issue 7 years ago • 3 comments

❓ Support Question

Required Information

? !
Operating system Linuxmint
PHP Telegram Bot version 0.61.0
PHP version php7
MySQL version one
Update Method Webhook
Self-signed certificate no
RAW update (if available) {...}

Summary

when i call Kernel V1 on bot i got log error, can help me ? i try if user Call command Kernel V1 my bot reply with text and document

switch (true) {
            case $text == 'Kernel V1': {
                    $this->conversation->update();
                    
                    $out_text = "This Kernel Version Zero\n";
                    $out_text .= "Build 2352682";
                    $data['chat_id'] = $chat_id; 
                    $data['caption']      = $out_text;
                    $data['document'] = Request::encodeFile(__DIR__ .'/Upload/kernel/kernel.zip');
                    $result = Request::sendDocument($data);
             
                    break;
                }
                case $text == 'Kernel V2': {
                    $this->conversation->update();

                    $data['text'] = 'This Kernel Version One:';
                    $data['chat_id'] = $chat_id;  
                    
                    $result = Request::sendMessage($data);
                    break;
                }
          }

Log Error :

PHP Warning: fopen(/home/oxygente/public_html/BotTelegram/oxygen-kernel/src/Commands/Commands/Upload/kernel/kernel.zip): failed to open stream: No such file or directory

thanks,

reactmorelab avatar Nov 24 '19 03:11 reactmorelab

full command https://pastebin.com/GpW29sUM

reactmorelab avatar Nov 24 '19 03:11 reactmorelab

According to the error message the file can't be found. Is the path correct?

Also, no need to use conversations here, just go for a simple if statement.

noplanman avatar Nov 25 '19 00:11 noplanman

@oxygenfox Make sure the path to your files are correct.

Closing off here as this is not a library issue.

noplanman avatar Dec 01 '19 22:12 noplanman