File Coverage

blib/lib/Telegram/Bot/Object/Message.pm
Criterion Covered Total %
statement 74 77 96.1
branch n/a
condition n/a
subroutine 26 27 96.3
pod 1 3 33.3
total 101 107 94.3


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