| 1 | package Telegram::Bot::Object::Message; | ||||||||||||||||||||
| 2 | 5 | $Telegram::Bot::Object::Message::VERSION = '0.029'; | |||||||||||||||||||
| 3 | # ABSTRACT: The base class for the Telegram type "Message". | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 5 | ▶ | use Mojo::Base 'Telegram::Bot::Object::Base'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 5 | ▶ | use Telegram::Bot::Object::User; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 5 | ▶ | use Telegram::Bot::Object::Chat; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 5 | ▶ | use Telegram::Bot::Object::MessageEntity; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 5 | ▶ | use Telegram::Bot::Object::Audio; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 5 | ▶ | use Telegram::Bot::Object::Document; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | 5 | ▶ | use Telegram::Bot::Object::Animation; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | 5 | ▶ | use Telegram::Bot::Object::Game; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | 5 | ▶ | use Telegram::Bot::Object::PhotoSize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | 5 | ▶ | use Telegram::Bot::Object::Sticker; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 17 | 5 | ▶ | use Telegram::Bot::Object::Video; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | 5 | ▶ | use Telegram::Bot::Object::Voice; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | 5 | ▶ | use Telegram::Bot::Object::VideoNote; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 20 | 5 | ▶ | use Telegram::Bot::Object::Contact; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 21 | 5 | ▶ | use Telegram::Bot::Object::Location; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 22 | 5 | ▶ | use Telegram::Bot::Object::Poll; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 23 | 5 | ▶ | use Telegram::Bot::Object::Location; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 24 | 5 | ▶ | use Telegram::Bot::Object::PhotoSize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 25 | 5 | ▶ | use Telegram::Bot::Object::Invoice; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 26 | 5 | ▶ | use Telegram::Bot::Object::Venue; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 27 | 5 | ▶ | use Telegram::Bot::Object::SuccessfulPayment; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 28 | 5 | ▶ | use Telegram::Bot::Object::PassportData; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 29 | 5 | ▶ | use Telegram::Bot::Object::InlineKeyboardMarkup; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 30 | 5 | ▶ | use Telegram::Bot::Object::ReplyKeyboardMarkup; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 31 | 5 | ▶ | use Telegram::Bot::Object::InlineQuery; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 32 | 5 | ▶ | use Telegram::Bot::Object::ForceReply; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 33 | 5 | ▶ | use Telegram::Bot::Object::ReplyParameters; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 5 | ▶ | use Data::Dumper; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | # basic message stuff | ||||||||||||||||||||
| 38 | 5 | has 'message_id'; | |||||||||||||||||||
| 39 | 5 | has 'from'; # User | |||||||||||||||||||
| 40 | 5 | has 'date'; | |||||||||||||||||||
| 41 | 5 | has 'chat'; # Chat | |||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | 5 | has 'forward_from'; # User | |||||||||||||||||||
| 44 | 5 | has 'forward_from_chat'; # Chat | |||||||||||||||||||
| 45 | 5 | has 'sender_chat'; # Chat | |||||||||||||||||||
| 46 | 5 | has 'forward_from_message_id'; | |||||||||||||||||||
| 47 | 5 | has 'forward_signature'; | |||||||||||||||||||
| 48 | 5 | has 'forward_sender_name'; | |||||||||||||||||||
| 49 | 5 | has 'forward_date'; | |||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 5 | has 'reply_to_message'; # Message | |||||||||||||||||||
| 52 | 5 | has 'edit_date'; | |||||||||||||||||||
| 53 | 5 | has 'media_group_id'; | |||||||||||||||||||
| 54 | 5 | has 'author_signature'; | |||||||||||||||||||
| 55 | 5 | has 'text'; | |||||||||||||||||||
| 56 | 5 | has 'entities'; # Array of MessageEntity | |||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 5 | has 'caption_entities'; # Array of MessageEntity | |||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | 5 | has 'audio'; # Audio | |||||||||||||||||||
| 61 | 5 | has 'document'; # Document | |||||||||||||||||||
| 62 | 5 | has 'animation'; # Animation | |||||||||||||||||||
| 63 | 5 | has 'game'; # Game | |||||||||||||||||||
| 64 | 5 | has 'photo'; # Array of PhotoSize | |||||||||||||||||||
| 65 | 5 | has 'sticker'; # Sticker | |||||||||||||||||||
| 66 | 5 | has 'video'; # Video | |||||||||||||||||||
| 67 | 5 | has 'voice'; # Voice | |||||||||||||||||||
| 68 | 5 | has 'video_note'; # VideoNote | |||||||||||||||||||
| 69 | 5 | has 'caption'; | |||||||||||||||||||
| 70 | 5 | has 'contact'; # Contact | |||||||||||||||||||
| 71 | 5 | has 'location'; # Location | |||||||||||||||||||
| 72 | 5 | has 'venue'; # Venue | |||||||||||||||||||
| 73 | 5 | has 'poll'; # Poll | |||||||||||||||||||
| 74 | 5 | has 'new_chat_members'; # Array of User | |||||||||||||||||||
| 75 | 5 | has 'left_chat_member'; # User | |||||||||||||||||||
| 76 | 5 | has 'new_chat_title'; | |||||||||||||||||||
| 77 | 5 | has 'new_chat_photo'; # Array of PhotoSize | |||||||||||||||||||
| 78 | 5 | has 'delete_chat_photo'; | |||||||||||||||||||
| 79 | 5 | has 'group_chat_created'; | |||||||||||||||||||
| 80 | 5 | has 'supergroup_chat_created'; | |||||||||||||||||||
| 81 | 5 | has 'channel_chat_created'; | |||||||||||||||||||
| 82 | 5 | has 'migrate_to_chat_id'; | |||||||||||||||||||
| 83 | 5 | has 'migrate_from_chat_id'; | |||||||||||||||||||
| 84 | 5 | has 'pinned_message'; # Message | |||||||||||||||||||
| 85 | 5 | has 'invoice'; # Invoice | |||||||||||||||||||
| 86 | 5 | has 'successful_payment'; # SuccessfulPayment | |||||||||||||||||||
| 87 | 5 | has 'connected_website'; | |||||||||||||||||||
| 88 | 5 | has 'passport_data'; # PassportData | |||||||||||||||||||
| 89 | 5 | has 'reply_markup'; # Array of InlineKeyboardMarkup/ReplyKeyboardMarkup | |||||||||||||||||||
| 90 | 5 | has 'inline_query'; # InlineQuery | |||||||||||||||||||
| 91 | 5 | has 'reply_parameters'; | |||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | 216 | ▶ | sub fields { | ||||||||||||||||||
|
Subroutine
fields: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 94 | return { | ||||||||||||||||||||
| 95 | 216 | 'scalar' => [qw/message_id date forward_from_message_id | |||||||||||||||||||
| 96 | forward_signature forward_sender_name | ||||||||||||||||||||
| 97 | forward_date edit_date media_group_id | ||||||||||||||||||||
| 98 | author_signature text caption | ||||||||||||||||||||
| 99 | new_chat_title delete_chat_photo | ||||||||||||||||||||
| 100 | group_chat_created supergroup_chat_created | ||||||||||||||||||||
| 101 | channel_chat_created migrate_to_chat_id | ||||||||||||||||||||
| 102 | migrate_from_chat_id connected_website/], | ||||||||||||||||||||
| 103 | 'Telegram::Bot::Object::User' => [qw/from forward_from new_chat_members left_chat_member /], | ||||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | 'Telegram::Bot::Object::Chat' => [qw/chat forward_from_chat sender_chat/], | ||||||||||||||||||||
| 106 | 'Telegram::Bot::Object::Message' => [qw/reply_to_message pinned_message/], | ||||||||||||||||||||
| 107 | 'Telegram::Bot::Object::MessageEntity' => [qw/entities caption_entities /], | ||||||||||||||||||||
| 108 | |||||||||||||||||||||
| 109 | 'Telegram::Bot::Object::Audio' => [qw/audio/], | ||||||||||||||||||||
| 110 | 'Telegram::Bot::Object::Document' => [qw/document/], | ||||||||||||||||||||
| 111 | 'Telegram::Bot::Object::Animation' => [qw/animation/], | ||||||||||||||||||||
| 112 | 'Telegram::Bot::Object::Game' => [qw/game/], | ||||||||||||||||||||
| 113 | 'Telegram::Bot::Object::PhotoSize' => [qw/photo new_chat_photo/], | ||||||||||||||||||||
| 114 | 'Telegram::Bot::Object::Sticker' => [qw/sticker/], | ||||||||||||||||||||
| 115 | 'Telegram::Bot::Object::Video' => [qw/video/], | ||||||||||||||||||||
| 116 | 'Telegram::Bot::Object::Voice' => [qw/voice/], | ||||||||||||||||||||
| 117 | 'Telegram::Bot::Object::VideoNote' => [qw/video_note/], | ||||||||||||||||||||
| 118 | |||||||||||||||||||||
| 119 | 'Telegram::Bot::Object::Contact' => [qw/contact/], | ||||||||||||||||||||
| 120 | 'Telegram::Bot::Object::Location' => [qw/location/], | ||||||||||||||||||||
| 121 | 'Telegram::Bot::Object::Venue' => [qw/venue/], | ||||||||||||||||||||
| 122 | |||||||||||||||||||||
| 123 | 'Telegram::Bot::Object::Poll' => [qw/poll/], | ||||||||||||||||||||
| 124 | |||||||||||||||||||||
| 125 | 'Telegram::Bot::Object::Invoice' => [qw/invoice/], | ||||||||||||||||||||
| 126 | 'Telegram::Bot::Object::SuccessfulPayment' => [qw/successful_payment/], | ||||||||||||||||||||
| 127 | 'Telegram::Bot::Object::PassportData' => [qw/passport_data/], | ||||||||||||||||||||
| 128 | 'Telegram::Bot::Object::InlineKeyboardMarkup' => [qw/reply_markup/], | ||||||||||||||||||||
| 129 | 'Telegram::Bot::Object::ReplyKeyboardMarkup' => [qw/reply_markup/], | ||||||||||||||||||||
| 130 | 'Telegram::Bot::Object::InlineQuery' => [qw/inline_query/], | ||||||||||||||||||||
| 131 | 'Telegram::Bot::Object::ForceReply' => [qw/reply_markup/], | ||||||||||||||||||||
| 132 | 'Telegram::Bot::Object::ReplyParameters' => [qw/reply_parameters/], | ||||||||||||||||||||
| 133 | |||||||||||||||||||||
| 134 | }; | ||||||||||||||||||||
| 135 | } | ||||||||||||||||||||
| 136 | |||||||||||||||||||||
| 137 | 35 | ▶ | sub arrays { | ||||||||||||||||||
|
Subroutine
arrays: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 138 | 35 | qw/photo entities caption_entities new_chat_members new_chat_photo/ | |||||||||||||||||||
| 139 | } | ||||||||||||||||||||
| 140 | |||||||||||||||||||||
| 141 | |||||||||||||||||||||
| 142 | 0 | ▶ | sub reply { | ||||||||||||||||||
|
Subroutine
reply: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||
| 143 | 0 | my $self = shift; | |||||||||||||||||||
| 144 | 0 | my $text = shift; | |||||||||||||||||||
| 145 | 0 | ▶ | my $args = shift // {}; | ||||||||||||||||||
|
Condition0%0/2
shift() // {}
MC/DC0%0/1
shift() // {}
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||
| 146 | |||||||||||||||||||||
| 147 | 0 | ▶ | $args->{reply_parameters} ||= Telegram::Bot::Object::ReplyParameters->new({message_id => $self->message_id }); | ||||||||||||||||||
|
Condition0%0/3
$args->{"reply_parameters"} ||= "Telegram::Bot::Object::ReplyParameters"->new({"message_id", $self->message_id})
MC/DC0%0/2
$args->{"reply_parameters"} ||= "Telegram::Bot::Object::ReplyParameters"->new({"message_id", $self->message_id})
$args->{"reply_parameters"}
"Telegram::Bot::Object::ReplyParameters"->new({"message_id", $self->message_id})
Truth table0%0/3
A ||= B
A= $args->{"reply_parameters"}B= "Telegram::Bot::Object::ReplyParameters"->new({"message_id", $self->message_id})
| |||||||||||||||||||||
| 148 | 0 | return $self->_brain->sendMessage({chat_id => $self->chat->id, text => $text, %$args }); | |||||||||||||||||||
| 149 | } | ||||||||||||||||||||
| 150 | |||||||||||||||||||||
| 151 | 5 | 1; | |||||||||||||||||||
| 152 | |||||||||||||||||||||
| 153 | __END__ | ||||||||||||||||||||