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.024';
3             # ABSTRACT: The base class for the Telegram type "Message".
4              
5              
6 5     5   3511 use Mojo::Base 'Telegram::Bot::Object::Base';
  5         565684  
  5         36  
7              
8 5     5   2353 use Telegram::Bot::Object::User;
  5         15  
  5         38  
9 5     5   2255 use Telegram::Bot::Object::Chat;
  5         14  
  5         42  
10 5     5   2244 use Telegram::Bot::Object::MessageEntity;
  5         11  
  5         39  
11 5     5   2182 use Telegram::Bot::Object::Audio;
  5         14  
  5         39  
12 5     5   2261 use Telegram::Bot::Object::Document;
  5         13  
  5         39  
13 5     5   2225 use Telegram::Bot::Object::Animation;
  5         15  
  5         51  
14 5     5   2664 use Telegram::Bot::Object::Game;
  5         23  
  5         37  
15 5     5   181 use Telegram::Bot::Object::PhotoSize;
  5         10  
  5         15  
16 5     5   2222 use Telegram::Bot::Object::Sticker;
  5         13  
  5         44  
17 5     5   2214 use Telegram::Bot::Object::Video;
  5         12  
  5         39  
18 5     5   2156 use Telegram::Bot::Object::Voice;
  5         15  
  5         38  
19 5     5   2244 use Telegram::Bot::Object::VideoNote;
  5         14  
  5         39  
20 5     5   2245 use Telegram::Bot::Object::Contact;
  5         13  
  5         37  
21 5     5   2160 use Telegram::Bot::Object::Location;
  5         13  
  5         45  
22 5     5   2202 use Telegram::Bot::Object::Poll;
  5         16  
  5         50  
23 5     5   195 use Telegram::Bot::Object::Location;
  5         10  
  5         26  
24 5     5   136 use Telegram::Bot::Object::PhotoSize;
  5         11  
  5         34  
25 5     5   2211 use Telegram::Bot::Object::Invoice;
  5         13  
  5         38  
26 5     5   2266 use Telegram::Bot::Object::Venue;
  5         13  
  5         36  
27 5     5   2376 use Telegram::Bot::Object::SuccessfulPayment;
  5         24  
  5         38  
28 5     5   2365 use Telegram::Bot::Object::PassportData;
  5         51  
  5         39  
29 5     5   2300 use Telegram::Bot::Object::InlineKeyboardMarkup;
  5         15  
  5         43  
30 5     5   2299 use Telegram::Bot::Object::ReplyKeyboardMarkup;
  5         185  
  5         53  
31              
32 5     5   203 use Data::Dumper;
  5         12  
  5         2606  
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 3320 '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 570 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__