File Coverage

blib/lib/Net/API/Telegram/Message.pm
Criterion Covered Total %
statement 7 55 12.7
branch n/a
condition n/a
subroutine 3 51 5.8
pod 47 47 100.0
total 57 153 37.2


line stmt bran cond sub pod time code
1             # -*- perl -*-
2             ##----------------------------------------------------------------------------
3             ## Net/API/Telegram/Message.pm
4             ## Version 0.1
5             ## Copyright(c) 2019 Jacques Deguest
6             ## Author: Jacques Deguest <jack@deguest.jp>
7             ## Created 2019/05/29
8             ## Modified 2020/05/20
9             ## All rights reserved.
10             ##
11             ## This program is free software; you can redistribute it and/or modify it
12             ## under the same terms as Perl itself.
13             ##----------------------------------------------------------------------------
14             package Net::API::Telegram::Message;
15             BEGIN
16             {
17 1     1   845 use strict;
  1         2  
  1         30  
18 1     1   5 use parent qw( Net::API::Telegram::Generic );
  1         2  
  1         5  
19 1     1   1022 our( $VERSION ) = '0.1';
20             };
21              
22 0     0 1   sub animation { return( shift->_set_get_object( 'animation', 'Net::API::Telegram::Animation', @_ ) ); }
23              
24 0     0 1   sub audio { return( shift->_set_get_object( 'audio', 'Net::API::Telegram::Audio', @_ ) ); }
25              
26 0     0 1   sub author_signature { return( shift->_set_get_scalar( 'author_signature', @_ ) ); }
27              
28 0     0 1   sub caption { return( shift->_set_get_scalar( 'caption', @_ ) ); }
29              
30 0     0 1   sub caption_entities { return( shift->_set_get_object_array( 'caption_entities', 'Net::API::Telegram::MessageEntity', @_ ) ); }
31              
32 0     0 1   sub channel_chat_created { return( shift->_set_get_scalar( 'channel_chat_created', @_ ) ); }
33              
34 0     0 1   sub chat { return( shift->_set_get_object( 'chat', 'Net::API::Telegram::Chat', @_ ) ); }
35              
36 0     0 1   sub connected_website { return( shift->_set_get_scalar( 'connected_website', @_ ) ); }
37              
38 0     0 1   sub contact { return( shift->_set_get_object( 'contact', 'Net::API::Telegram::Contact', @_ ) ); }
39              
40 0     0 1   sub date { return( shift->_set_get_datetime( 'date', @_ ) ); }sub delete_chat_photo { return( shift->_set_get_scalar( 'delete_chat_photo', @_ ) ); }
  0     0 1    
41              
42 0     0 1   sub document { return( shift->_set_get_object( 'document', 'Net::API::Telegram::Document', @_ ) ); }
43              
44 0     0 1   sub edit_date { return( shift->_set_get_datetime( 'edit_date', @_ ) ); }sub entities { return( shift->_set_get_object_array( 'entities', 'Net::API::Telegram::MessageEntity', @_ ) ); }
  0     0 1    
45              
46 0     0 1   sub forward_date { return( shift->_set_get_datetime( 'forward_date', @_ ) ); }sub forward_from { return( shift->_set_get_object( 'forward_from', 'Net::API::Telegram::User', @_ ) ); }
  0     0 1    
47              
48 0     0 1   sub forward_from_chat { return( shift->_set_get_object( 'forward_from_chat', 'Net::API::Telegram::Chat', @_ ) ); }
49              
50 0     0 1   sub forward_from_message_id { return( shift->_set_get_number( 'forward_from_message_id', @_ ) ); }
51              
52 0     0 1   sub forward_sender_name { return( shift->_set_get_scalar( 'forward_sender_name', @_ ) ); }
53              
54 0     0 1   sub forward_signature { return( shift->_set_get_scalar( 'forward_signature', @_ ) ); }
55              
56 0     0 1   sub from { return( shift->_set_get_object( 'from', 'Net::API::Telegram::User', @_ ) ); }
57              
58 0     0 1   sub game { return( shift->_set_get_object( 'game', 'Net::API::Telegram::Game', @_ ) ); }
59              
60 0     0 1   sub group_chat_created { return( shift->_set_get_scalar( 'group_chat_created', @_ ) ); }
61              
62 0     0 1   sub invoice { return( shift->_set_get_object( 'invoice', 'Net::API::Telegram::Invoice', @_ ) ); }
63              
64 0     0 1   sub left_chat_member { return( shift->_set_get_object( 'left_chat_member', 'Net::API::Telegram::User', @_ ) ); }
65              
66 0     0 1   sub location { return( shift->_set_get_object( 'location', 'Net::API::Telegram::Location', @_ ) ); }
67              
68 0     0 1   sub media_group_id { return( shift->_set_get_scalar( 'media_group_id', @_ ) ); }
69              
70 0     0 1   sub message_id { return( shift->_set_get_number( 'message_id', @_ ) ); }
71              
72 0     0 1   sub migrate_from_chat_id { return( shift->_set_get_number( 'migrate_from_chat_id', @_ ) ); }
73              
74 0     0 1   sub migrate_to_chat_id { return( shift->_set_get_number( 'migrate_to_chat_id', @_ ) ); }
75              
76 0     0 1   sub new_chat_members { return( shift->_set_get_object_array( 'new_chat_members', 'Net::API::Telegram::User', @_ ) ); }
77              
78 0     0 1   sub new_chat_photo { return( shift->_set_get_object_array( 'new_chat_photo', 'Net::API::Telegram::PhotoSize', @_ ) ); }
79              
80 0     0 1   sub new_chat_title { return( shift->_set_get_scalar( 'new_chat_title', @_ ) ); }
81              
82 0     0 1   sub passport_data { return( shift->_set_get_object( 'passport_data', 'Net::API::Telegram::PassportData', @_ ) ); }
83              
84 0     0 1   sub photo { return( shift->_set_get_object_array( 'photo', 'Net::API::Telegram::PhotoSize', @_ ) ); }
85              
86 0     0 1   sub pinned_message { return( shift->_set_get_object( 'pinned_message', 'Net::API::Telegram::Message', @_ ) ); }
87              
88 0     0 1   sub poll { return( shift->_set_get_object( 'poll', 'Net::API::Telegram::Poll', @_ ) ); }
89              
90 0     0 1   sub reply_markup { return( shift->_set_get_object( 'reply_markup', 'Net::API::Telegram::InlineKeyboardMarkup', @_ ) ); }
91              
92 0     0 1   sub reply_to_message { return( shift->_set_get_object( 'reply_to_message', 'Net::API::Telegram::Message', @_ ) ); }
93              
94 0     0 1   sub sticker { return( shift->_set_get_object( 'sticker', 'Net::API::Telegram::Sticker', @_ ) ); }
95              
96 0     0 1   sub successful_payment { return( shift->_set_get_object( 'successful_payment', 'Net::API::Telegram::SuccessfulPayment', @_ ) ); }
97              
98 0     0 1   sub supergroup_chat_created { return( shift->_set_get_scalar( 'supergroup_chat_created', @_ ) ); }
99              
100 0     0 1   sub text { return( shift->_set_get_scalar( 'text', @_ ) ); }
101              
102 0     0 1   sub venue { return( shift->_set_get_object( 'venue', 'Net::API::Telegram::Venue', @_ ) ); }
103              
104 0     0 1   sub video { return( shift->_set_get_object( 'video', 'Net::API::Telegram::Video', @_ ) ); }
105              
106 0     0 1   sub video_note { return( shift->_set_get_object( 'video_note', 'Net::API::Telegram::VideoNote', @_ ) ); }
107              
108 0     0 1   sub voice { return( shift->_set_get_object( 'voice', 'Net::API::Telegram::Voice', @_ ) ); }
109              
110 0     0     sub _is_boolean { return( grep( /^$_[1]$/, qw( channel_chat_created delete_chat_photo group_chat_created supergroup_chat_created ) ) ); }
111              
112             1;
113              
114             __END__
115              
116             =encoding utf-8
117              
118             =head1 NAME
119              
120             Net::API::Telegram::Message - A message
121              
122             =head1 SYNOPSIS
123              
124             my $msg = Net::API::Telegram::Message->new( %data ) ||
125             die( Net::API::Telegram::Message->error, "\n" );
126              
127             =head1 DESCRIPTION
128              
129             L<Net::API::Telegram::Message> is a Telegram Message Object as defined here L<https://core.telegram.org/bots/api#message>
130              
131             This module has been automatically generated from Telegram API documentation by the script scripts/telegram-doc2perl-methods.pl.
132              
133             =head1 METHODS
134              
135             =over 4
136              
137             =item B<new>( {INIT HASH REF}, %PARAMETERS )
138              
139             B<new>() will create a new object for the package, pass any argument it might receive
140             to the special standard routine B<init> that I<must> exist.
141             Then it returns what returns B<init>().
142              
143             The valid parameters are as follow. Methods available here are also parameters to the B<new> method.
144              
145             =over 8
146              
147             =item * I<verbose>
148              
149             =item * I<debug>
150              
151             =back
152              
153             =item B<animation>( L<Net::API::Telegram::Animation> )
154              
155             Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set
156              
157             =item B<audio>( L<Net::API::Telegram::Audio> )
158              
159             Optional. Message is an audio file, information about the file
160              
161             =item B<author_signature>( String )
162              
163             Optional. Signature of the post author for messages in channels
164              
165             =item B<caption>( String )
166              
167             Optional. Caption for the animation, audio, document, photo, video or voice, 0-1024 characters
168              
169             =item B<caption_entities>( Array of MessageEntity )
170              
171             Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
172              
173             =item B<channel_chat_created>( True )
174              
175             Optional. Service message: the channel has been created. This field can‘t be received in a message coming through updates, because bot can’t be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.
176              
177             =item B<chat>( L<Net::API::Telegram::Chat> )
178              
179             Conversation the message belongs to
180              
181             =item B<connected_website>( String )
182              
183             Optional. The domain name of the website on which the user has logged in. More about Telegram Login »
184              
185             =item B<contact>( L<Net::API::Telegram::Contact> )
186              
187             Optional. Message is a shared contact, information about the contact
188              
189             =item B<date>( Date )
190              
191             Date the message was sent in Unix time
192              
193             =item B<delete_chat_photo>( True )
194              
195             Optional. Service message: the chat photo was deleted
196              
197             =item B<document>( L<Net::API::Telegram::Document> )
198              
199             Optional. Message is a general file, information about the file
200              
201             =item B<edit_date>( Date )
202              
203             Optional. Date the message was last edited in Unix time
204              
205             =item B<entities>( Array of MessageEntity )
206              
207             Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
208              
209             =item B<forward_date>( Date )
210              
211             Optional. For forwarded messages, date the original message was sent in Unix time
212              
213             =item B<forward_from>( L<Net::API::Telegram::User> )
214              
215             Optional. For forwarded messages, sender of the original message
216              
217             =item B<forward_from_chat>( L<Net::API::Telegram::Chat> )
218              
219             Optional. For messages forwarded from channels, information about the original channel
220              
221             =item B<forward_from_message_id>( Integer )
222              
223             Optional. For messages forwarded from channels, identifier of the original message in the channel
224              
225             =item B<forward_sender_name>( String )
226              
227             Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages
228              
229             =item B<forward_signature>( String )
230              
231             Optional. For messages forwarded from channels, signature of the post author if present
232              
233             =item B<from>( L<Net::API::Telegram::User> )
234              
235             Optional. Sender, empty for messages sent to channels
236              
237             =item B<game>( L<Net::API::Telegram::Game> )
238              
239             Optional. Message is a game, information about the game. More about games »
240              
241             =item B<group_chat_created>( True )
242              
243             Optional. Service message: the group has been created
244              
245             =item B<invoice>( L<Net::API::Telegram::Invoice> )
246              
247             Optional. Message is an invoice for a payment, information about the invoice. More about payments »
248              
249             =item B<left_chat_member>( L<Net::API::Telegram::User> )
250              
251             Optional. A member was removed from the group, information about them (this member may be the bot itself)
252              
253             =item B<location>( L<Net::API::Telegram::Location> )
254              
255             Optional. Message is a shared location, information about the location
256              
257             =item B<media_group_id>( String )
258              
259             Optional. The unique identifier of a media message group this message belongs to
260              
261             =item B<message_id>( Integer )
262              
263             Unique message identifier inside this chat
264              
265             =item B<migrate_from_chat_id>( Integer )
266              
267             Optional. The supergroup has been migrated from a group with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
268              
269             =item B<migrate_to_chat_id>( Integer )
270              
271             Optional. The group has been migrated to a supergroup with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
272              
273             =item B<new_chat_members>( Array of User )
274              
275             Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
276              
277             =item B<new_chat_photo>( Array of PhotoSize )
278              
279             Optional. A chat photo was change to this value
280              
281             =item B<new_chat_title>( String )
282              
283             Optional. A chat title was changed to this value
284              
285             =item B<passport_data>( L<Net::API::Telegram::PassportData> )
286              
287             Optional. Telegram Passport data
288              
289             =item B<photo>( Array of PhotoSize )
290              
291             Optional. Message is a photo, available sizes of the photo
292              
293             =item B<pinned_message>( L<Net::API::Telegram::Message> )
294              
295             Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply.
296              
297             =item B<poll>( L<Net::API::Telegram::Poll> )
298              
299             Optional. Message is a native poll, information about the poll
300              
301             =item B<reply_markup>( L<Net::API::Telegram::InlineKeyboardMarkup> )
302              
303             Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.
304              
305             =item B<reply_to_message>( L<Net::API::Telegram::Message> )
306              
307             Optional. For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.
308              
309             =item B<sticker>( L<Net::API::Telegram::Sticker> )
310              
311             Optional. Message is a sticker, information about the sticker
312              
313             =item B<successful_payment>( L<Net::API::Telegram::SuccessfulPayment> )
314              
315             Optional. Message is a service message about a successful payment, information about the payment. More about payments »
316              
317             =item B<supergroup_chat_created>( True )
318              
319             Optional. Service message: the supergroup has been created. This field can‘t be received in a message coming through updates, because bot can’t be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.
320              
321             =item B<text>( String )
322              
323             Optional. For text messages, the actual UTF-8 text of the message, 0-4096 characters.
324              
325             =item B<venue>( L<Net::API::Telegram::Venue> )
326              
327             Optional. Message is a venue, information about the venue
328              
329             =item B<video>( L<Net::API::Telegram::Video> )
330              
331             Optional. Message is a video, information about the video
332              
333             =item B<video_note>( L<Net::API::Telegram::VideoNote> )
334              
335             Optional. Message is a video note, information about the video message
336              
337             =item B<voice>( L<Net::API::Telegram::Voice> )
338              
339             Optional. Message is a voice message, information about the file
340              
341             =back
342              
343             =head1 COPYRIGHT
344              
345             Copyright (c) 2000-2019 DEGUEST Pte. Ltd.
346              
347             =head1 AUTHOR
348              
349             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
350              
351             =head1 SEE ALSO
352              
353             L<Net::API::Telegram>
354              
355             =head1 COPYRIGHT & LICENSE
356              
357             Copyright (c) 2018-2019 DEGUEST Pte. Ltd.
358              
359             You can use, copy, modify and redistribute this package and associated
360             files under the same terms as Perl itself.
361              
362             =cut
363