Skip to content

Commit

Permalink
Merge pull request #19 from jonnywilliamson/master
Browse files Browse the repository at this point in the history
Added new features from August API Changelog
  • Loading branch information
irazasyed committed Aug 20, 2015
2 parents 018bae4 + 386f293 commit 38b776b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/Objects/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public function relations()
'photo' => PhotoSize::class,
'sticker' => Sticker::class,
'video' => Video::class,
'voice' => Voice::class,
'contact' => Contact::class,
'location' => Location::class,
'new_chat_participant' => User::class,
Expand Down
14 changes: 14 additions & 0 deletions src/Objects/Voice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Irazasyed\Telegram\Objects;

class Voice extends BaseObject
{
/**
* @inheritdoc
*/
public function relations()
{
return [];
}
}
31 changes: 26 additions & 5 deletions src/Telegram.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,23 +240,44 @@ public function sendPhoto($chat_id, $photo, $caption = null, $reply_to_message_i
}

/**
* Send audio files.
* Send regular audio files.
*
* @link https://core.telegram.org/bots/api#sendaudio
*
* @param int $chat_id
* @param string $audio
* @param int $duration
* @param string $performer
* @param string $title
* @param int $reply_to_message_id
* @param KeyboardMarkup $reply_markup
* @return Message
*/
public function sendAudio($chat_id, $audio, $duration = null, $performer = null, $title = null, $reply_to_message_id = null, $reply_markup = null)
{
$params = compact('chat_id', 'audio', 'duration', 'performer', 'title', 'reply_to_message_id', 'reply_markup');

return $this->uploadFile('sendAudio', $params);
}

/**
* Send voice audio files.
*
* @link https://core.telegram.org/bots/api#sendaudio
*
* @param int $chat_id
* @param string $audio
* @param string $voice
* @param int $duration
* @param int $reply_to_message_id
* @param KeyboardMarkup $reply_markup
*
* @return \Irazasyed\Telegram\Objects\Message
*/
public function sendAudio($chat_id, $audio, $duration = null, $reply_to_message_id = null, $reply_markup = null)
public function sendVoice($chat_id, $voice, $duration = null, $reply_to_message_id = null, $reply_markup = null)
{
$params = compact('chat_id', 'audio', 'duration', 'reply_to_message_id', 'reply_markup');
$params = compact('chat_id', 'voice', 'duration', 'reply_to_message_id', 'reply_markup');

return $this->uploadFile('sendAudio', $params);
return $this->uploadFile('sendVoice', $params);
}

/**
Expand Down

0 comments on commit 38b776b

Please sign in to comment.