Skip to content

Commit 560a91a

Browse files
committed
Merge pull request zyberspace#23 from yorch81:send_pic_file
(Also fixed some whitespaces and made the doc and variable names match better the rest of the project)
2 parents 59a9d32 + 083c5e7 commit 560a91a

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

lib/Zyberspace/Telegram/Cli/Client.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,4 +372,42 @@ public function getHistory($peer, $limit = null, $offset = null)
372372

373373
return $this->exec('history ' . $this->escapePeer($peer) . $limit . $offset);
374374
}
375+
376+
/**
377+
* Send picture to peer
378+
*
379+
* @param string $peer The peer, gets escaped with escapePeer()
380+
* @param string $path The picture path, gets formatted with formatFileName()
381+
* @return boolean
382+
*
383+
* @uses exec()
384+
* @uses escapePeer()
385+
* @uses formatFileName()
386+
*/
387+
public function sendPicture($peer, $path)
388+
{
389+
$peer = $this->escapePeer($peer);
390+
$formattedPath = $this->formatFileName($path);
391+
392+
return $this->exec('send_photo ' . $peer . ' ' . $formattedPath);
393+
}
394+
395+
/**
396+
* Send file to peer
397+
*
398+
* @param string $peer The peer, gets escaped with escapePeer()
399+
* @param string $path The file path, gets formatted with formatFileName()
400+
* @return boolean
401+
*
402+
* @uses exec()
403+
* @uses escapePeer()
404+
* @uses formatFileName()
405+
*/
406+
public function sendFile($peer, $path)
407+
{
408+
$peer = $this->escapePeer($peer);
409+
$formattedPath = $this->formatFileName($path);
410+
411+
return $this->exec('send_file ' . $peer . ' ' . $formattedPath);
412+
}
375413
}

0 commit comments

Comments
 (0)