File Coverage

blib/lib/Telegram/Bot/Object/Message.pm
Criterion Covered Total %
statement 77 80 96.2
branch n/a
condition n/a
subroutine 27 28 96.4
pod 1 3 33.3
total 105 111 94.5


line stmt bran cond sub pod time code
1             package Telegram::Bot::Object::Message;
2             $Telegram::Bot::Object::Message::VERSION = '0.023';
3             # ABSTRACT: The base class for the Telegram type "Message".
4              
5              
6 5     5   3790 use Mojo::Base 'Telegram::Bot::Object::Base';
  5         590819  
  5         37  
7              
8 5     5   2543 use Telegram::Bot::Object::User;
  5         30  
  5         42  
9 5     5   2381 use Telegram::Bot::Object::Chat;
  5         13  
  5         53  
10 5     5   2387 use Telegram::Bot::Object::MessageEntity;
  5         18  
  5         37  
11 5     5   2305 use Telegram::Bot::Object::Audio;
  5         13  
  5         45  
12 5     5   2361 use Telegram::Bot::Object::Document;
  5         14  
  5         38  
13 5     5   2308 use Telegram::Bot::Object::Animation;
  5         16  
  5         60  
14 5     5   2383 use Telegram::Bot::Object::Game;
  5         12  
  5         43  
15 5     5   181 use Telegram::Bot::Object::PhotoSize;
  5         10  
  5         15  
16 5     5   2320 use Telegram::Bot::Object::Sticker;
  5         12  
  5         44  
17 5     5   2367 use Telegram::Bot::Object::Video;
  5         14  
  5         37  
18 5     5   2312 use Telegram::Bot::Object::Voice;
  5         16  
  5         35  
19 5     5   2289 use Telegram::Bot::Object::VideoNote;
  5         14  
  5         40  
20 5     5   2371 use Telegram::Bot::Object::Contact;
  5         13  
  5         40  
21 5     5   2304 use Telegram::Bot::Object::Location;
  5         15  
  5         47  
22 5     5   2304 use Telegram::Bot::Object::Poll;
  5         12  
  5         35  
23 5     5   190 use Telegram::Bot::Object::Location;
  5         11  
  5         24  
24 5     5   146 use Telegram::Bot::Object::PhotoSize;
  5         11  
  5         26  
25 5     5   2315 use Telegram::Bot::Object::Invoice;
  5         13  
  5         40  
26 5     5   2393 use Telegram::Bot::Object::Venue;
  5         14  
  5         45  
27 5     5   2452 use Telegram::Bot::Object::SuccessfulPayment;
  5         12  
  5         57  
28 5     5   2462 use Telegram::Bot::Object::PassportData;
  5         83  
  5         42  
29 5     5   2498 use Telegram::Bot::Object::InlineKeyboardMarkup;
  5         14  
  5         52  
30 5     5   2433 use Telegram::Bot::Object::ReplyKeyboardMarkup;
  5         226  
  5         53  
31              
32 5     5   201 use Data::Dumper;
  5         11  
  5         2710  
33              
34             # basic message stuff
35             has 'message_id';
36             has 'from'; # User
37             has 'date';
38             has 'chat'; # Chat
39              
40             has 'forward_from'; # User
41             has 'forward_from_chat'; # Chat
42             has 'forward_from_message_id';
43             has 'forward_signature';
44             has 'forward_sender_name';
45             has 'forward_date';
46              
47             has 'reply_to_message'; # Message
48             has 'edit_date';
49             has 'media_group_id';
50             has 'author_signature';
51             has 'text';
52             has 'entities'; # Array of MessageEntity
53              
54             has 'caption_entities'; # Array of MessageEntity
55              
56             has 'audio'; # Audio
57             has 'document'; # Document
58             has 'animation'; # Animation
59             has 'game'; # Game
60             has 'photo'; # Array of PhotoSize
61             has 'sticker'; # Sticker
62             has 'video'; # Video
63             has 'voice'; # Voice
64             has 'video_note'; # VideoNote
65             has 'caption';
66             has 'contact'; # Contact
67             has 'location'; # Location
68             has 'venue'; # Venue
69             has 'poll'; # Poll
70             has 'new_chat_members'; # Array of User
71             has 'left_chat_member'; # User
72             has 'new_chat_title';
73             has 'new_chat_photo'; # Array of PhotoSize
74             has 'delete_chat_photo';
75             has 'group_chat_created';
76             has 'supergroup_chat_created';
77             has 'channel_chat_created';
78             has 'migrate_to_chat_id';
79             has 'migrate_from_chat_id';
80             has 'pinned_message'; # Message
81             has 'invoice'; # Invoice
82             has 'successful_payment'; # SuccessfulPayment
83             has 'connected_website';
84             has 'passport_data'; # PassportData
85             has 'reply_markup'; # Array of InlineKeyboardMarkup/ReplyKeyboardMarkup
86              
87             sub fields {
88             return {
89 192     192 0 3352 'scalar' => [qw/message_id date forward_from_message_id
90             forward_signature forward_sender_name
91             forward_date edit_date media_group_id
92             author_signature text caption
93             new_chat_title delete_chat_photo
94             group_chat_created supergroup_chat_created
95             channel_chat_created migrate_to_chat_id
96             migrate_from_chat_id connected_website/],
97             'Telegram::Bot::Object::User' => [qw/from forward_from new_chat_members left_chat_member /],
98              
99             'Telegram::Bot::Object::Chat' => [qw/chat forward_from_chat/],
100             'Telegram::Bot::Object::Message' => [qw/reply_to_message pinned_message/],
101             'Telegram::Bot::Object::MessageEntity' => [qw/entities caption_entities /],
102              
103             'Telegram::Bot::Object::Audio' => [qw/audio/],
104             'Telegram::Bot::Object::Document' => [qw/document/],
105             'Telegram::Bot::Object::Animation' => [qw/animation/],
106             'Telegram::Bot::Object::Game' => [qw/game/],
107             'Telegram::Bot::Object::PhotoSize' => [qw/photo new_chat_photo/],
108             'Telegram::Bot::Object::Sticker' => [qw/sticker/],
109             'Telegram::Bot::Object::Video' => [qw/video/],
110             'Telegram::Bot::Object::Voice' => [qw/voice/],
111             'Telegram::Bot::Object::VideoNote' => [qw/video_note/],
112              
113             'Telegram::Bot::Object::Contact' => [qw/contact/],
114             'Telegram::Bot::Object::Location' => [qw/location/],
115             'Telegram::Bot::Object::Venue' => [qw/venue/],
116              
117             'Telegram::Bot::Object::Poll' => [qw/poll/],
118              
119             'Telegram::Bot::Object::Invoice' => [qw/invoice/],
120             'Telegram::Bot::Object::SuccessfulPayment' => [qw/successful_payment/],
121             'Telegram::Bot::Object::PassportData' => [qw/passport_data/],
122             'Telegram::Bot::Object::InlineKeyboardMarkup' => [qw/reply_markup/],
123             'Telegram::Bot::Object::ReplyKeyboardMarkup' => [qw/reply_markup/],
124              
125             };
126             }
127              
128             sub arrays {
129 35     35 1 598 qw/photo entities caption_entities new_chat_members new_chat_photo/
130             }
131              
132              
133             sub reply {
134 0     0 0   my $self = shift;
135 0           my $text = shift;
136 0           return $self->_brain->sendMessage({chat_id => $self->chat->id, text => $text});
137             }
138              
139             1;
140              
141             __END__