NAME

Net::API::Telegram::Audio - An audio file to be treated as music by the Telegram clients

SYNOPSIS

my $msg = Net::API::Telegram::Audio->new( %data ) || 
die( Net::API::Telegram::Audio->error, "\n" );

DESCRIPTION

Net::API::Telegram::Audio is a Telegram Message Object as defined here https://core.telegram.org/bots/api#audio

This module has been automatically generated from Telegram API documentation by the script scripts/telegram-doc2perl-methods.pl.

METHODS

new( {INIT HASH REF}, %PARAMETERS )

new() will create a new object for the package, pass any argument it might receive to the special standard routine init that must exist. Then it returns what returns init().

The valid parameters are as follow. Methods available here are also parameters to the new method.

  • verbose

  • debug

download( file_id, [ file extension ] )

Given a file id like file_id, this will call the getFile() method from the parent Net::API::Telegram package and receive a Net::API::Telegram::File object in return, which contains a file path valid for only one hour according to Telegram api here https://core.telegram.org/bots/api#getfile. With this file path, this download method will issue a http get request and retrieve the file and save it locally in a temproary file generated by File::Temp. If an extension is provided, it will be appended to the temproary file name such as myfile.jpg otherwise the extension will be gussed from the mime type returned by the Telegram http server, if any.

This method returns undef() on error and sets a Net::API::Telegram::Error or, on success, returns a hash reference with the following properties:

filepath

The full path to the temporary file

mime

The mime type returned by the server.

response

The HTTP::Response

size

The size in bytes of the file fetched

download( )
duration( Integer )

Duration of the audio in seconds as defined by sender

file_id( String )

Identifier for this file

file_size( Integer )

Optional. File size

mime_type( String )

Optional. MIME type of the file as defined by sender

performer( String )

Optional. Performer of the audio as defined by sender or by audio tags

thumb( Net::API::Telegram::PhotoSize )

Optional. Thumbnail of the album cover to which the music file belongs

title( String )

Optional. Title of the audio as defined by sender or by audio tags

COPYRIGHT

Copyright (c) 2000-2019 DEGUEST Pte. Ltd.

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Net::API::Telegram

COPYRIGHT & LICENSE

Copyright (c) 2018-2019 DEGUEST Pte. Ltd.

You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.