Telegram/Message.pm

filter: Statementstmt 14.2% 8 / 56 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 5.8% 3 / 51 Podpod 100% 47 / 47 totaltotal 37.6% 58 / 154 SCAR 4.9
CC
1
Cov
14%
animation
2.0
audio
2.0
author_signature
2.0
CRAP 1.6
« Telegram/Response.pm ↑ Summary Telegram/ChatMember.pm »
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 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶ use parent qw( Net::API::Telegram::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶ our( $VERSION ) = '0.1';
Subroutine BEGIN: called CC=1 SCAR=0.0
20 };
21  
22 0 ▶sub animation { return( shift->_set_get_object( 'animation', 'Net::API::Telegram::Animation', @_ ) ); }
Subroutine animation: not called CC=1 SCAR=6.9
Pod documented
23  
24 0 ▶sub audio { return( shift->_set_get_object( 'audio', 'Net::API::Telegram::Audio', @_ ) ); }
Subroutine audio: not called CC=1 SCAR=6.9
Pod documented
25  
26 0 ▶sub author_signature { return( shift->_set_get_scalar( 'author_signature', @_ ) ); }
Subroutine author_signature: not called CC=1 SCAR=6.9
Pod documented
27  
28 0 ▶sub caption { return( shift->_set_get_scalar( 'caption', @_ ) ); }
Subroutine caption: not called CC=1 SCAR=6.9
Pod documented
29  
30 0 ▶sub caption_entities { return( shift->_set_get_object_array( 'caption_entities', 'Net::API::Telegram::MessageEntity', @_ ) ); }
Subroutine caption_entities: not called CC=1 SCAR=6.9
Pod documented
31  
32 0 ▶sub channel_chat_created { return( shift->_set_get_scalar( 'channel_chat_created', @_ ) ); }
Subroutine channel_chat_created: not called CC=1 SCAR=6.9
Pod documented
33  
34 0 ▶sub chat { return( shift->_set_get_object( 'chat', 'Net::API::Telegram::Chat', @_ ) ); }
Subroutine chat: not called CC=1 SCAR=6.9
Pod documented
35  
36 0 ▶sub connected_website { return( shift->_set_get_scalar( 'connected_website', @_ ) ); }
Subroutine connected_website: not called CC=1 SCAR=6.9
Pod documented
37  
38 0 ▶sub contact { return( shift->_set_get_object( 'contact', 'Net::API::Telegram::Contact', @_ ) ); }
Subroutine contact: not called CC=1 SCAR=6.9
Pod documented
39  
40 0 ▶sub date { return( shift->_set_get_datetime( 'date', @_ ) ); }sub delete_chat_photo { return( shift->_set_get_scalar( 'delete_chat_photo', @_ ) ); }
Subroutine date: not called CC=1 SCAR=6.9
Subroutine delete_chat_photo: not called CC=1 SCAR=6.9
Pod documented
Pod documented
41  
42 0 ▶sub document { return( shift->_set_get_object( 'document', 'Net::API::Telegram::Document', @_ ) ); }
Subroutine document: not called CC=1 SCAR=6.9
Pod documented
43  
44 0 ▶sub edit_date { return( shift->_set_get_datetime( 'edit_date', @_ ) ); }sub entities { return( shift->_set_get_object_array( 'entities', 'Net::API::Telegram::MessageEntity', @_ ) ); }
Subroutine edit_date: not called CC=1 SCAR=6.9
Subroutine entities: not called CC=1 SCAR=6.9
Pod documented
Pod documented
45  
46 0 ▶sub forward_date { return( shift->_set_get_datetime( 'forward_date', @_ ) ); }sub forward_from { return( shift->_set_get_object( 'forward_from', 'Net::API::Telegram::User', @_ ) ); }
Subroutine forward_date: not called CC=1 SCAR=6.9
Subroutine forward_from: not called CC=1 SCAR=6.9
Pod documented
Pod documented
47  
48 0 ▶sub forward_from_chat { return( shift->_set_get_object( 'forward_from_chat', 'Net::API::Telegram::Chat', @_ ) ); }
Subroutine forward_from_chat: not called CC=1 SCAR=6.9
Pod documented
49  
50 0 ▶sub forward_from_message_id { return( shift->_set_get_number( 'forward_from_message_id', @_ ) ); }
Subroutine forward_from_message_id: not called CC=1 SCAR=6.9
Pod documented
51  
52 0 ▶sub forward_sender_name { return( shift->_set_get_scalar( 'forward_sender_name', @_ ) ); }
Subroutine forward_sender_name: not called CC=1 SCAR=6.9
Pod documented
53  
54 0 ▶sub forward_signature { return( shift->_set_get_scalar( 'forward_signature', @_ ) ); }
Subroutine forward_signature: not called CC=1 SCAR=6.9
Pod documented
55  
56 0 ▶sub from { return( shift->_set_get_object( 'from', 'Net::API::Telegram::User', @_ ) ); }
Subroutine from: not called CC=1 SCAR=6.9
Pod documented
57  
58 0 ▶sub game { return( shift->_set_get_object( 'game', 'Net::API::Telegram::Game', @_ ) ); }
Subroutine game: not called CC=1 SCAR=6.9
Pod documented
59  
60 0 ▶sub group_chat_created { return( shift->_set_get_scalar( 'group_chat_created', @_ ) ); }
Subroutine group_chat_created: not called CC=1 SCAR=6.9
Pod documented
61  
62 0 ▶sub invoice { return( shift->_set_get_object( 'invoice', 'Net::API::Telegram::Invoice', @_ ) ); }
Subroutine invoice: not called CC=1 SCAR=6.9
Pod documented
63  
64 0 ▶sub left_chat_member { return( shift->_set_get_object( 'left_chat_member', 'Net::API::Telegram::User', @_ ) ); }
Subroutine left_chat_member: not called CC=1 SCAR=6.9
Pod documented
65  
66 0 ▶sub location { return( shift->_set_get_object( 'location', 'Net::API::Telegram::Location', @_ ) ); }
Subroutine location: not called CC=1 SCAR=6.9
Pod documented
67  
68 0 ▶sub media_group_id { return( shift->_set_get_scalar( 'media_group_id', @_ ) ); }
Subroutine media_group_id: not called CC=1 SCAR=6.9
Pod documented
69  
70 0 ▶sub message_id { return( shift->_set_get_number( 'message_id', @_ ) ); }
Subroutine message_id: not called CC=1 SCAR=6.9
Pod documented
71  
72 0 ▶sub migrate_from_chat_id { return( shift->_set_get_number( 'migrate_from_chat_id', @_ ) ); }
Subroutine migrate_from_chat_id: not called CC=1 SCAR=6.9
Pod documented
73  
74 0 ▶sub migrate_to_chat_id { return( shift->_set_get_number( 'migrate_to_chat_id', @_ ) ); }
Subroutine migrate_to_chat_id: not called CC=1 SCAR=6.9
Pod documented
75  
76 0 ▶sub new_chat_members { return( shift->_set_get_object_array( 'new_chat_members', 'Net::API::Telegram::User', @_ ) ); }
Subroutine new_chat_members: not called CC=1 SCAR=6.9
Pod documented
77  
78 0 ▶sub new_chat_photo { return( shift->_set_get_object_array( 'new_chat_photo', 'Net::API::Telegram::PhotoSize', @_ ) ); }
Subroutine new_chat_photo: not called CC=1 SCAR=6.9
Pod documented
79  
80 0 ▶sub new_chat_title { return( shift->_set_get_scalar( 'new_chat_title', @_ ) ); }
Subroutine new_chat_title: not called CC=1 SCAR=6.9
Pod documented
81  
82 0 ▶sub passport_data { return( shift->_set_get_object( 'passport_data', 'Net::API::Telegram::PassportData', @_ ) ); }
Subroutine passport_data: not called CC=1 SCAR=6.9
Pod documented
83  
84 0 ▶sub photo { return( shift->_set_get_object_array( 'photo', 'Net::API::Telegram::PhotoSize', @_ ) ); }
Subroutine photo: not called CC=1 SCAR=6.9
Pod documented
85  
86 0 ▶sub pinned_message { return( shift->_set_get_object( 'pinned_message', 'Net::API::Telegram::Message', @_ ) ); }
Subroutine pinned_message: not called CC=1 SCAR=6.9
Pod documented
87  
88 0 ▶sub poll { return( shift->_set_get_object( 'poll', 'Net::API::Telegram::Poll', @_ ) ); }
Subroutine poll: not called CC=1 SCAR=6.9
Pod documented
89  
90 0 ▶sub reply_markup { return( shift->_set_get_object( 'reply_markup', 'Net::API::Telegram::InlineKeyboardMarkup', @_ ) ); }
Subroutine reply_markup: not called CC=1 SCAR=6.9
Pod documented
91  
92 0 ▶sub reply_to_message { return( shift->_set_get_object( 'reply_to_message', 'Net::API::Telegram::Message', @_ ) ); }
Subroutine reply_to_message: not called CC=1 SCAR=6.9
Pod documented
93  
94 0 ▶sub sticker { return( shift->_set_get_object( 'sticker', 'Net::API::Telegram::Sticker', @_ ) ); }
Subroutine sticker: not called CC=1 SCAR=6.9
Pod documented
95  
96 0 ▶sub successful_payment { return( shift->_set_get_object( 'successful_payment', 'Net::API::Telegram::SuccessfulPayment', @_ ) ); }
Subroutine successful_payment: not called CC=1 SCAR=6.9
Pod documented
97  
98 0 ▶sub supergroup_chat_created { return( shift->_set_get_scalar( 'supergroup_chat_created', @_ ) ); }
Subroutine supergroup_chat_created: not called CC=1 SCAR=6.9
Pod documented
99  
100 0 ▶sub text { return( shift->_set_get_scalar( 'text', @_ ) ); }
Subroutine text: not called CC=1 SCAR=6.9
Pod documented
101  
102 0 ▶sub venue { return( shift->_set_get_object( 'venue', 'Net::API::Telegram::Venue', @_ ) ); }
Subroutine venue: not called CC=1 SCAR=6.9
Pod documented
103  
104 0 ▶sub video { return( shift->_set_get_object( 'video', 'Net::API::Telegram::Video', @_ ) ); }
Subroutine video: not called CC=1 SCAR=6.9
Pod documented
105  
106 0 ▶sub video_note { return( shift->_set_get_object( 'video_note', 'Net::API::Telegram::VideoNote', @_ ) ); }
Subroutine video_note: not called CC=1 SCAR=6.9
Pod documented
107  
108 0 ▶sub voice { return( shift->_set_get_object( 'voice', 'Net::API::Telegram::Voice', @_ ) ); }
Subroutine voice: not called CC=1 SCAR=6.9
Pod documented
109  
110 0 ▶sub _is_boolean { return( grep( /^$_[1]$/, qw( channel_chat_created delete_chat_photo group_chat_created supergroup_chat_created ) ) ); }
Subroutine _is_boolean: not called CC=1 SCAR=6.9
111  
112 1 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  
« Telegram/Response.pm ↑ Summary Telegram/ChatMember.pm »