From a9bb74b440b0b292af05c6bb14122aeb5c1cb9a4 Mon Sep 17 00:00:00 2001 From: eleksir Date: Sat, 12 Feb 2022 17:31:09 +0300 Subject: [PATCH] Perlcritic overhaul, apply to Teapot lib too --- .gitignore | 10 +-- .perlcriticrc | 34 ++++++++- bin/aleesa-telegram | 35 ++++----- confcheck.pl | 4 +- lib/BotLib.pm | 8 +- lib/BotLib/Admin.pm | 35 +++++---- lib/BotLib/Conf.pm | 13 +++- lib/BotLib/Util.pm | 8 +- lib/RedisLib.pm | 20 ++--- lib/Teapot/Bot.pm | 4 +- lib/Teapot/Bot/Brain.pm | 30 ++++---- lib/Teapot/Bot/Object/Animation.pm | 12 ++- lib/Teapot/Bot/Object/Audio.pm | 9 ++- lib/Teapot/Bot/Object/Base.pm | 22 +++--- lib/Teapot/Bot/Object/CallbackGame.pm | 11 ++- lib/Teapot/Bot/Object/Chat.pm | 17 +++-- lib/Teapot/Bot/Object/ChatInviteLink.pm | 11 ++- lib/Teapot/Bot/Object/ChatLocation.pm | 9 ++- lib/Teapot/Bot/Object/ChatMember.pm | 15 +++- lib/Teapot/Bot/Object/ChatMemberUpdated.pm | 21 +++-- lib/Teapot/Bot/Object/ChatPermissions.pm | 14 +++- lib/Teapot/Bot/Object/ChatPhoto.pm | 9 ++- lib/Teapot/Bot/Object/Contact.pm | 9 ++- lib/Teapot/Bot/Object/Dice.pm | 9 ++- lib/Teapot/Bot/Object/Document.pm | 14 ++-- lib/Teapot/Bot/Object/EncryptedCredentials.pm | 9 ++- .../Bot/Object/EncryptedPassportElement.pm | 9 ++- lib/Teapot/Bot/Object/Game.pm | 14 ++-- lib/Teapot/Bot/Object/InlineKeyboardButton.pm | 13 +++- lib/Teapot/Bot/Object/InlineKeyboardMarkup.pm | 11 ++- lib/Teapot/Bot/Object/Invoice.pm | 9 ++- lib/Teapot/Bot/Object/Location.pm | 9 ++- lib/Teapot/Bot/Object/LoginUrl.pm | 9 ++- lib/Teapot/Bot/Object/Message.pm | 76 ++++++++++--------- .../Object/MessageAutoDeleteTimerChanged.pm | 9 ++- lib/Teapot/Bot/Object/MessageEntity.pm | 11 ++- lib/Teapot/Bot/Object/PassportData.pm | 13 +++- lib/Teapot/Bot/Object/PhotoSize.pm | 10 ++- lib/Teapot/Bot/Object/Poll.pm | 11 ++- lib/Teapot/Bot/Object/PollAnswer.pm | 9 ++- lib/Teapot/Bot/Object/PollOption.pm | 9 ++- .../Bot/Object/ProximityAlertTriggered.pm | 9 ++- lib/Teapot/Bot/Object/Sticker.pm | 11 ++- lib/Teapot/Bot/Object/SuccessfulPayment.pm | 9 ++- lib/Teapot/Bot/Object/User.pm | 10 ++- lib/Teapot/Bot/Object/Venue.pm | 13 +++- lib/Teapot/Bot/Object/Video.pm | 13 +++- lib/Teapot/Bot/Object/VideoNote.pm | 10 ++- lib/Teapot/Bot/Object/Voice.pm | 9 ++- lib/Teapot/Bot/Object/VoiceChatEnded.pm | 9 ++- .../Object/VoiceChatParticipantsInvited.pm | 11 ++- lib/Teapot/Bot/Object/VoiceChatScheduled.pm | 9 ++- lib/Teapot/Bot/Object/VoiceChatStarted.pm | 9 ++- lib/TelegramBot.pm | 20 +++-- 54 files changed, 493 insertions(+), 263 deletions(-) diff --git a/.gitignore b/.gitignore index 63a5526..0cfad71 100644 --- a/.gitignore +++ b/.gitignore @@ -2,15 +2,7 @@ _Deparsed_XSubs.pm .idea/** .vscode/** .vstags -aleesa-telegram-bot.pid +aleesa-telegram.pid data/cache/** data/config.json -data/fortune/** -data/friday/** -data/gamestat/** -data/image/** -data/karma/** -data/lat/** -data/proverb/** -data/telegrambot-brains/** vendor_perl/** diff --git a/.perlcriticrc b/.perlcriticrc index 2b3a696..c9effe5 100644 --- a/.perlcriticrc +++ b/.perlcriticrc @@ -95,4 +95,36 @@ lib_sections = NAME | VERSION | DESCRIPTION | AUTHOR | LICENSE AND COPYRIGHT [-ControlStructures::ProhibitUntilBlocks] # Until is really useful if condition is simple, so let's assume condition is -# always simple to read \ No newline at end of file +# always simple to read + +[-CodeLayout::RequireASCII] +# Nope + +[-Editor::RequireEmacsFileVariables] + +[-TooMuchCode::ProhibitUnnecessaryUTF8Pragma] + +[-ErrorHandling::RequireUseOfExceptions] + +[-Lax::ProhibitEmptyQuotes::ExceptAsFallback] + +[-TooMuchCode::ProhibitDuplicateLiteral] + +[-ValuesAndExpressions::RequireConstantOnLeftSideOfEquality] +# But constants on the right side of coditional expression are more readable! + +[-Lax::RequireConstantOnLeftSideOfEquality::ExceptEq] +# same as previous + +[ValuesAndExpressions::RestrictLongStrings] +max_length = 200 + +[-TooMuchCode::ProhibitExtraStricture] + +[-Documentation::ProhibitUnbalancedParens] +# closing paren on the next, you fucking fuck, so shut your ass up and stop farting on me + +[-Subroutines::ProhibitCallsToUndeclaredSubs] +# Can't find how to mark DSL keywords +# (Moo{,se} provides has/with/extends/etc., Dancer{,2} provides more) +# This is problematic diff --git a/bin/aleesa-telegram b/bin/aleesa-telegram index 57c96e4..2b5d5bf 100755 --- a/bin/aleesa-telegram +++ b/bin/aleesa-telegram @@ -1,6 +1,6 @@ #!/usr/bin/perl -use 5.018; +use 5.018; ## no critic (ProhibitImplicitImport) use strict; use warnings; use utf8; @@ -29,9 +29,10 @@ no Cwd; use Cwd::utf8 qw (chdir abs_path); use File::Basename qw (basename dirname); use File::Path qw (make_path); +use File::Spec qw (); use Log::Any qw ($log); -use Log::Any::Adapter; -use Log::Any::For::Std; +use Log::Any::Adapter (); +use Log::Any::For::Std (); use POSIX qw (setgid setuid setsid); use BotLib::Conf qw (LoadConf); use TelegramBot qw (RunTelegramBot); @@ -68,8 +69,8 @@ if ($UID == 0) { make_path ( $piddir, { uid => $uid, - group => $gid - } + group => $gid, + }, ); } @@ -80,8 +81,8 @@ if ($UID == 0) { make_path ( $logdir, { uid => $uid, - group => $gid - } + group => $gid, + }, ) or die "Unable to create $logdir: $OS_ERROR\n"; } } @@ -101,14 +102,14 @@ if (defined $logfile) { # verbosity paticulary for CHI. Log::Any::Adapter->set ( { - category => 'CHI::Driver' + category => 'CHI::Driver', }, 'File', $logfile, - log_level => 'warn' + log_level => 'warn', ); } else { - Log::Any::Adapter->set ('File', '/dev/null'); + Log::Any::Adapter->set ('File', File::Spec->devnull); } # double fork attach to /dev/null all stdio and go background @@ -120,7 +121,7 @@ my $apath = abs_path $PROGRAM_NAME; unless (defined $apath) { $log->fatal ("[FATAL] Unable to get abs_path: $OS_ERROR\n"); exit 1; -}; +} # write pidfile my $pidfile = sprintf '%s/%s.pid', $piddir, basename $apath; @@ -152,7 +153,7 @@ our $RCONN; # run bot, at last RunTelegramBot (); -if (-f $pidfile) { +if (-e $pidfile) { unlink $pidfile; } @@ -160,11 +161,11 @@ exit 0; sub daemonize { __fork (); - POSIX::setsid (); - open STDIN, '<', '/dev/null'; ## no critic (InputOutput::RequireCheckedSyscalls, InputOutput::RequireCheckedOpen) + setsid (); + open STDIN, '<', File::Spec->devnull; ## no critic (InputOutput::RequireCheckedSyscalls, InputOutput::RequireCheckedOpen) # we handle STDOUT && STDERR via Log::Any::For::Std, so do not close them explicitly - #open STDOUT, '>', '/dev/null'; ## no critic (InputOutput::RequireCheckedSyscalls, InputOutput::RequireCheckedOpen) - #open STDERR, '>', '/dev/null'; ## no critic (InputOutput::RequireCheckedSyscalls, InputOutput::RequireCheckedOpen) + #open STDOUT, '>', File::Spec->devnull; ## no critic (InputOutput::RequireCheckedSyscalls, InputOutput::RequireCheckedOpen) + #open STDERR, '>', File::Spec->devnull; ## no critic (InputOutput::RequireCheckedSyscalls, InputOutput::RequireCheckedOpen) __fork (); umask 0; return; @@ -188,7 +189,7 @@ sub __fork { sub __signal_handler { $log->info ("[INFO] Caught a signal $OS_ERROR"); - if (-f $pidfile) { + if (-e $pidfile) { unlink $pidfile; } diff --git a/confcheck.pl b/confcheck.pl index 6638b28..bb1b750 100755 --- a/confcheck.pl +++ b/confcheck.pl @@ -1,13 +1,13 @@ #!/usr/bin/perl -use 5.018; +use 5.018; ## no critic (ProhibitImplicitImport) use strict; use warnings; use utf8; use open qw (:std :utf8); use English qw ( -no_match_vars ); use lib qw (./lib ./vendor_perl ./vendor_perl/lib/perl5); -use JSON::XS; +use JSON::XS (); use version; our $VERSION = qw (1.0); diff --git a/lib/BotLib.pm b/lib/BotLib.pm index 740b58f..073ffbd 100644 --- a/lib/BotLib.pm +++ b/lib/BotLib.pm @@ -1,18 +1,16 @@ package BotLib; # store here utility functions that are not protocol-specified -use 5.018; +use 5.018; ## no critic (ProhibitImplicitImport) use strict; use warnings; use utf8; use open qw (:std :utf8); use English qw ( -no_match_vars ); -use Carp qw (carp); use Clone qw (clone); use Math::Random::Secure qw (irand); -use Data::Dumper; -use Log::Any qw ($log); +use Data::Dumper qw (Dumper); use BotLib::Conf qw (LoadConf); use BotLib::Admin qw (@ForbiddenMessageTypes GetForbiddenTypes AddForbiddenType @@ -139,7 +137,7 @@ sub Command { my $pubsub = $main::REDIS->pubsub; $pubsub->json ($c->{'redis_router_channel'})->notify ( - $c->{'redis_router_channel'} => $rmsg + $c->{'redis_router_channel'} => $rmsg, ); # Если команда не найдена, но строка подозрительно напоминает команду help } elsif (substr ($text, 1) eq 'help' || substr ($text, 1) eq 'помощь') { diff --git a/lib/BotLib/Admin.pm b/lib/BotLib/Admin.pm index 2485d0e..f84d5db 100644 --- a/lib/BotLib/Admin.pm +++ b/lib/BotLib/Admin.pm @@ -1,14 +1,13 @@ package BotLib::Admin; -use 5.018; +use 5.018; ## no critic (ProhibitImplicitImport) use strict; use warnings; use utf8; use open qw (:std :utf8); use English qw ( -no_match_vars ); -use Carp qw (cluck croak); -use CHI; -use CHI::Driver::BerkeleyDB; +use CHI (); +use CHI::Driver::BerkeleyDB (); use BotLib::Conf qw (LoadConf); use BotLib::Util qw (utf2sha1); @@ -33,7 +32,7 @@ sub GetForbiddenTypes { my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir, - namespace => __PACKAGE__ . '_' . 'censor' . '_' . utf2sha1 ($chatid) + namespace => __PACKAGE__ . '_' . 'censor' . '_' . utf2sha1 ($chatid), ); foreach (@ForbiddenMessageTypes) { @@ -60,7 +59,7 @@ sub AddForbiddenType { my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir, - namespace => __PACKAGE__ . '_' . 'censor' . '_' . utf2sha1 ($chatid) + namespace => __PACKAGE__ . '_' . 'censor' . '_' . utf2sha1 ($chatid), ); $cache->set ($type, 1, 'never'); @@ -74,7 +73,7 @@ sub DelForbiddenType { my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir, - namespace => __PACKAGE__ . '_' . 'censor' . '_' . utf2sha1 ($chatid) + namespace => __PACKAGE__ . '_' . 'censor' . '_' . utf2sha1 ($chatid), ); $cache->remove ($type); @@ -88,7 +87,7 @@ sub ListForbidden { my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir, - namespace => __PACKAGE__ . '_' . 'censor' . '_' . utf2sha1 ($chatid) + namespace => __PACKAGE__ . '_' . 'censor' . '_' . utf2sha1 ($chatid), ); foreach (@ForbiddenMessageTypes) { @@ -116,7 +115,7 @@ sub FortuneToggle (@) { my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir, - namespace => __PACKAGE__ . '_' . 'fortune' + namespace => __PACKAGE__ . '_' . 'fortune', ); my $state = $cache->get ($chatid); @@ -152,7 +151,7 @@ sub FortuneStatus ($) { my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir, - namespace => __PACKAGE__ . '_' . 'fortune' + namespace => __PACKAGE__ . '_' . 'fortune', ); my $state = $cache->get ($chatid); @@ -170,7 +169,7 @@ sub FortuneToggleList () { my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir, - namespace => __PACKAGE__ . '_' . 'fortune' + namespace => __PACKAGE__ . '_' . 'fortune', ); return $cache->get_keys (); @@ -184,7 +183,7 @@ sub ChanMsgToggle (@) { my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir, - namespace => __PACKAGE__ . '_' . 'chan_msg' + namespace => __PACKAGE__ . '_' . 'chan_msg', ); my $state = $cache->get ($chatid); @@ -227,7 +226,7 @@ sub ChanMsgStatus ($) { my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir, - namespace => __PACKAGE__ . '_' . 'chan_msg' + namespace => __PACKAGE__ . '_' . 'chan_msg', ); my $state = $cache->get ($chatid); @@ -251,7 +250,7 @@ sub ChanMsgEnabled ($) { my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir, - namespace => __PACKAGE__ . '_' . 'chan_msg' + namespace => __PACKAGE__ . '_' . 'chan_msg', ); my $state = $cache->get ($chatid); @@ -271,7 +270,7 @@ sub ChanMsgToggleList () { my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir, - namespace => __PACKAGE__ . '_' . 'chan_msg' + namespace => __PACKAGE__ . '_' . 'chan_msg', ); return $cache->get_keys (); @@ -285,7 +284,7 @@ sub PluginStatus (@) { my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir, - namespace => __PACKAGE__ . '_' . 'plugin' . '_' . utf2sha1 ($chatid) + namespace => __PACKAGE__ . '_' . 'plugin' . '_' . utf2sha1 ($chatid), ); my $state = $cache->get ($plugin); @@ -315,7 +314,7 @@ sub PluginEnabled (@) { my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir, - namespace => __PACKAGE__ . '_' . 'plugin' . '_' . utf2sha1 ($chatid) + namespace => __PACKAGE__ . '_' . 'plugin' . '_' . utf2sha1 ($chatid), ); my $state = $cache->get ($plugin); @@ -336,7 +335,7 @@ sub PluginToggle (@) { my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir, - namespace => __PACKAGE__ . '_' . 'plugin' . '_' . utf2sha1 ($chatid) + namespace => __PACKAGE__ . '_' . 'plugin' . '_' . utf2sha1 ($chatid), ); my $state = $cache->get ($plugin); diff --git a/lib/BotLib/Conf.pm b/lib/BotLib/Conf.pm index 3706bf2..9c34f06 100644 --- a/lib/BotLib/Conf.pm +++ b/lib/BotLib/Conf.pm @@ -1,13 +1,13 @@ package BotLib::Conf; -# loads config +# Загружает конфиг файл -use 5.018; +use 5.018; ## no critic (ProhibitImplicitImport) use strict; use warnings; use utf8; use open qw (:std :utf8); use English qw ( -no_match_vars ); -use JSON::XS; +use JSON::XS (); use version; our $VERSION = qw (1.0); use Exporter qw (import); @@ -15,7 +15,12 @@ our @EXPORT_OK = qw (LoadConf); sub LoadConf { my $c = 'data/config.json'; - open my $CH, '<', $c or die "[FATAL] No conf at $c: $OS_ERROR\n"; + my $CH; + + unless (open $CH, '<', $c) { + die "[FATAL] No conf at $c: $OS_ERROR\n"; + } + my $len = (stat $c) [7]; my $json; my $readlen = read $CH, $json, $len; diff --git a/lib/BotLib/Util.pm b/lib/BotLib/Util.pm index 9d4bc4d..0ae39fe 100644 --- a/lib/BotLib/Util.pm +++ b/lib/BotLib/Util.pm @@ -1,16 +1,16 @@ package BotLib::Util; -use 5.018; +use 5.018; ## no critic (ProhibitImplicitImport) use strict; use warnings; use utf8; use open qw (:std :utf8); use English qw ( -no_match_vars ); use Digest::SHA qw (sha1_base64); -use Encode; -use MIME::Base64; +use Encode qw (encode_utf8); +use MIME::Base64 qw (encode_base64); use Text::Fuzzy qw (distance_edits); -use URI::URL; +use URI::URL qw (url); use version; our $VERSION = qw (1.0); use Exporter qw (import); diff --git a/lib/RedisLib.pm b/lib/RedisLib.pm index 74a4c95..082718c 100644 --- a/lib/RedisLib.pm +++ b/lib/RedisLib.pm @@ -1,6 +1,6 @@ package RedisLib; -use 5.018; +use 5.018; ## no critic (ProhibitImplicitImport) use strict; use warnings; use utf8; @@ -8,12 +8,12 @@ use open qw (:std :utf8); use Log::Any qw ($log); # Чтобы "уж точно" использовать hiredis-биндинги, загрузим этот модуль перед Mojo::Redis -use Protocol::Redis::XS; -use Mojo::Redis; -use Mojo::Redis::Connection; +use Protocol::Redis::XS (); +use Mojo::Redis (); +use Mojo::Redis::Connection (); use BotLib::Conf qw (LoadConf); -use Teapot::Bot::Object::ChatPermissions; +use Teapot::Bot::Object::ChatPermissions (); use version; our $VERSION = qw (1.0); use Exporter qw (import); @@ -48,7 +48,7 @@ sub redis_parse_message { } return; -}; +} sub redis_events_listener { $log->notice ('[NOTICE] Run redis events listener'); @@ -66,7 +66,7 @@ sub redis_events_listener { } my $r = Mojo::Redis->new ( - sprintf 'redis://%s:%s/1', $c->{redis_server}, $c->{redis_port} + sprintf 'redis://%s:%s/1', $c->{redis_server}, $c->{redis_port}, ); $log->notice ('[NOTICE] New redis client registered, registering callbacks'); @@ -85,11 +85,11 @@ sub redis_events_listener { $log->error ("[ERROR] Redis connection error: $error"); $main::RCONN = undef; return; - } + }, ); return; - } + }, ); # Subscribe to channels @@ -102,7 +102,7 @@ sub redis_events_listener { $log->info ("[INFO] Subscribing to $channel"); $sub->{$channel} = $pubsub->json ($channel)->listen ( - $channel => sub { $rpm->(@_); } + $channel => sub { $rpm->(@_); }, ); } diff --git a/lib/Teapot/Bot.pm b/lib/Teapot/Bot.pm index d4aef84..d87d682 100644 --- a/lib/Teapot/Bot.pm +++ b/lib/Teapot/Bot.pm @@ -2,6 +2,8 @@ package Teapot::Bot; use strict; use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; $Teapot::Bot::VERSION = '0.022'; # ABSTRACT: A base class to make your very own Telegram bot @@ -11,7 +13,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME diff --git a/lib/Teapot/Bot/Brain.pm b/lib/Teapot/Bot/Brain.pm index 717b5ee..6ce7957 100644 --- a/lib/Teapot/Bot/Brain.pm +++ b/lib/Teapot/Bot/Brain.pm @@ -6,25 +6,27 @@ use Mojo::Base -base; use strict; use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; use English qw ( -no_match_vars ); -use Mojo::IOLoop; -use Mojo::UserAgent; +use Mojo::IOLoop (); +use Mojo::UserAgent (); use Carp qw/croak cluck confess/; # use croak where we return error up to app that supply something wrong # use cluck where we want to say that something bad but non-critical happen in # lower layer (Mojo loop) # use confess where we want to say that fatal error happen in lower layer (Mojo loop) -use Log::Any; -use Data::Dumper; +use Log::Any (); +use Data::Dumper qw (Dumper); -use Teapot::Bot::Object::Message; -use Teapot::Bot::Object::Poll; -use Teapot::Bot::Object::PollAnswer; -use Teapot::Bot::Object::ChatMemberUpdated; -use Teapot::Bot::Object::User; -use Teapot::Bot::Object::Chat; -use Teapot::Bot::Object::ChatMember; -use Teapot::Bot::Object::ChatInviteLink; +use Teapot::Bot::Object::Message (); +use Teapot::Bot::Object::Poll (); +use Teapot::Bot::Object::PollAnswer (); +use Teapot::Bot::Object::ChatMemberUpdated (); +use Teapot::Bot::Object::User (); +use Teapot::Bot::Object::Chat (); +use Teapot::Bot::Object::ChatMember (); +use Teapot::Bot::Object::ChatInviteLink (); $Teapot::Bot::Brain::VERSION = '0.022'; @@ -706,7 +708,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -764,7 +766,7 @@ This method will add a sub to run every C<$seconds> seconds. Pass this method two parameters, the number of seconds between executions, and the coderef to execute. -Your coderef will be passed the L object when it is +Your coderef will be passed the C object when it is executed. =head2 add_listener diff --git a/lib/Teapot/Bot/Object/Animation.pm b/lib/Teapot/Bot/Object/Animation.pm index 03c95fe..7856e23 100644 --- a/lib/Teapot/Bot/Object/Animation.pm +++ b/lib/Teapot/Bot/Object/Animation.pm @@ -1,9 +1,13 @@ package Teapot::Bot::Object::Animation; # ABSTRACT: The base class for Telegram message 'Animation' type. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::PhotoSize; -use Carp qw/croak/; +use Teapot::Bot::Object::PhotoSize (); $Teapot::Bot::Object::Animation::VERSION = '0.022'; @@ -31,7 +35,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -45,7 +49,7 @@ version 0.022 The base class for Telegram message 'Animation' type. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/Audio.pm b/lib/Teapot/Bot/Object/Audio.pm index e7ffa10..3668e46 100644 --- a/lib/Teapot/Bot/Object/Audio.pm +++ b/lib/Teapot/Bot/Object/Audio.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::Audio; # ABSTRACT: The base class for Telegram 'Audio' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::Audio::VERSION = '0.022'; @@ -28,7 +33,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -42,7 +47,7 @@ version 0.022 The base class for Telegram 'Audio' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/Base.pm b/lib/Teapot/Bot/Object/Base.pm index c0bee27..06a3a1f 100644 --- a/lib/Teapot/Bot/Object/Base.pm +++ b/lib/Teapot/Bot/Object/Base.pm @@ -1,11 +1,17 @@ package Teapot::Bot::Object::Base; # ABSTRACT: The base class for all Teapot::Bot::Object objects. -use Mojo::Base -base; -use List::Util qw/any/; +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Carp qw/croak cluck/; -use Data::Dumper; +use Data::Dumper qw (Dumper); use JSON::PP (); +use List::Util qw/any/; + +use Mojo::Base -base; $Teapot::Bot::Object::Base::VERSION = '0.022'; @@ -27,7 +33,6 @@ sub _field_is_array { return; } - sub array_of_arrays { return qw// } #override if needed sub _field_is_array_of_arrays { my $self = shift; @@ -59,9 +64,6 @@ sub create_from_array { return $obj; } - cluck "Dumping class: " . Dumper ($class); - cluck "Dumping array: " . Dumper ($array); - # it's stub, return $obj return $obj; } @@ -163,7 +165,7 @@ sub as_hashref { if (ref($self->$field) ne 'ARRAY' && defined $self->$field); # array types $hash->{$field} = [ - map { $_->as_hashref } @{ $self->$field } + map { $_->as_hashref } @{ $self->$field }, ] if (ref($self->$field) eq 'ARRAY'); } } @@ -177,7 +179,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -193,7 +195,7 @@ The base class for all Telegram::Bot::Object objects. This class should not be instantiated itself. Instead, instantiate a sub-class. -You should generally not need to instantiate objects of sub-classes of L, +You should generally not need to instantiate objects of sub-classes of C, instead the appropriate objects will be created from an incoming request via L. diff --git a/lib/Teapot/Bot/Object/CallbackGame.pm b/lib/Teapot/Bot/Object/CallbackGame.pm index 2310074..9f06688 100644 --- a/lib/Teapot/Bot/Object/CallbackGame.pm +++ b/lib/Teapot/Bot/Object/CallbackGame.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::CallbackGame; # ABSTRACT: The base class for Telegram message 'CallbackGame' type. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::CallbackGame::VERSION = '0.022'; @@ -8,7 +13,7 @@ $Teapot::Bot::Object::CallbackGame::VERSION = '0.022'; # "A placeholder, currently holds no information. Use BotFather to set up your game" sub fields { - return { }, + return { }; } 1; @@ -17,7 +22,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -31,7 +36,7 @@ version 0.022 The base class for Telegram message 'CallbackGame' type. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/Chat.pm b/lib/Teapot/Bot/Object/Chat.pm index c63ad77..634c738 100644 --- a/lib/Teapot/Bot/Object/Chat.pm +++ b/lib/Teapot/Bot/Object/Chat.pm @@ -1,11 +1,16 @@ package Teapot::Bot::Object::Chat; # ABSTRACT: The base class for Telegram 'Chat' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::ChatPhoto; -use Teapot::Bot::Object::Message; -use Teapot::Bot::Object::ChatPermissions; -use Teapot::Bot::Object::ChatLocation; +use Teapot::Bot::Object::ChatPhoto (); +use Teapot::Bot::Object::Message (); +use Teapot::Bot::Object::ChatPermissions (); +use Teapot::Bot::Object::ChatLocation (); $Teapot::Bot::Object::Chat::VERSION = '0.022'; @@ -64,7 +69,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -78,7 +83,7 @@ version 0.022 The base class for Telegram 'Chat' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 METHODS diff --git a/lib/Teapot/Bot/Object/ChatInviteLink.pm b/lib/Teapot/Bot/Object/ChatInviteLink.pm index 7618e96..9ddcb19 100644 --- a/lib/Teapot/Bot/Object/ChatInviteLink.pm +++ b/lib/Teapot/Bot/Object/ChatInviteLink.pm @@ -1,8 +1,13 @@ package Teapot::Bot::Object::ChatInviteLink; # ABSTRACT: The base class for Telegram message 'ChatInviteLink' type. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::User; +use Teapot::Bot::Object::User (); $Teapot::Bot::Object::ChatInviteLink::VERSION = '0.022'; @@ -31,7 +36,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -45,7 +50,7 @@ version 0.022 The base class for Telegram message 'ChatInviteLink' type. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/ChatLocation.pm b/lib/Teapot/Bot/Object/ChatLocation.pm index dab079c..daef82f 100644 --- a/lib/Teapot/Bot/Object/ChatLocation.pm +++ b/lib/Teapot/Bot/Object/ChatLocation.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::ChatLocation; # ABSTRACT: The base class for Telegram message 'ChatLocation' type. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::ChatLocation::VERSION = '0.022'; @@ -21,7 +26,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -35,7 +40,7 @@ version 0.022 The base class for Telegram message 'ChatLocation' type. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/ChatMember.pm b/lib/Teapot/Bot/Object/ChatMember.pm index 52740ac..a5c40bf 100644 --- a/lib/Teapot/Bot/Object/ChatMember.pm +++ b/lib/Teapot/Bot/Object/ChatMember.pm @@ -1,10 +1,17 @@ package Teapot::Bot::Object::ChatMember; # ABSTRACT: The base class for Telegram 'ChatMember' type objects -use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::User; +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Carp qw(cluck); +use Mojo::Base 'Teapot::Bot::Object::Base'; +use Teapot::Bot::Object::User (); + + $Teapot::Bot::Object::ChatMember::VERSION = '0.022'; # ChatMemberOwner @@ -130,7 +137,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -144,7 +151,7 @@ version 0.022 The base class for Telegram 'ChatMember' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 METHODS diff --git a/lib/Teapot/Bot/Object/ChatMemberUpdated.pm b/lib/Teapot/Bot/Object/ChatMemberUpdated.pm index a6d97b0..5ace960 100644 --- a/lib/Teapot/Bot/Object/ChatMemberUpdated.pm +++ b/lib/Teapot/Bot/Object/ChatMemberUpdated.pm @@ -1,12 +1,17 @@ package Teapot::Bot::Object::ChatMemberUpdated; # ABSTRACT: The base class for Telegram 'ChatMemberUpdated' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::Chat; -use Teapot::Bot::Object::User; -use Teapot::Bot::Object::ChatMember; -use Teapot::Bot::Object::ChatInviteLink; -use Teapot::Bot::Object::Voice; +use Teapot::Bot::Object::Chat (); +use Teapot::Bot::Object::User (); +use Teapot::Bot::Object::ChatMember (); +use Teapot::Bot::Object::ChatInviteLink (); +use Teapot::Bot::Object::Voice (); $Teapot::Bot::Object::ChatMemberUpdated::VERSION = '0.022'; @@ -27,7 +32,7 @@ sub fields { 'scalar' => [qw/date text/], 'Teapot::Bot::Object::ChatMember' => [qw/old_chat_member new_chat_member/], 'Teapot::Bot::Object::Voice' => [qw/voice/], - 'Teapot::Bot::Object::ChatInviteLink' => [qw/invite_link/] + 'Teapot::Bot::Object::ChatInviteLink' => [qw/invite_link/], }; } @@ -37,7 +42,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -51,7 +56,7 @@ version 0.022 The base class for Telegram 'ChatMemberUpdated' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/ChatPermissions.pm b/lib/Teapot/Bot/Object/ChatPermissions.pm index 7002547..f40b93c 100644 --- a/lib/Teapot/Bot/Object/ChatPermissions.pm +++ b/lib/Teapot/Bot/Object/ChatPermissions.pm @@ -1,8 +1,14 @@ package Teapot::Bot::Object::ChatPermissions; # ABSTRACT: The base class for Telegram 'ChatPermissions' type objects + +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Carp qw(carp); use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Brain; +use Teapot::Bot::Brain (); $Teapot::Bot::Object::ChatPermissions::VERSION = '0.022'; @@ -25,7 +31,7 @@ sub fields { return { 'scalar' => [qw/can_send_messages can_send_media_messages can_send_polls can_send_other_messages can_add_web_page_previews can_change_info - can_invite_users can_pin_messages/] + can_invite_users can_pin_messages/], }; } @@ -84,7 +90,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -98,7 +104,7 @@ version 0.022 The base class for Telegram 'ChatPermissions' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 METHODS diff --git a/lib/Teapot/Bot/Object/ChatPhoto.pm b/lib/Teapot/Bot/Object/ChatPhoto.pm index 1e6be0c..04516a5 100644 --- a/lib/Teapot/Bot/Object/ChatPhoto.pm +++ b/lib/Teapot/Bot/Object/ChatPhoto.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::ChatPhoto; # ABSTRACT: The base class for Telegram 'ChatPhoto' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::ChatPhoto::VERSION = '0.022'; @@ -22,7 +27,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -36,7 +41,7 @@ version 0.022 The base class for Telegram 'ChatPhoto' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/Contact.pm b/lib/Teapot/Bot/Object/Contact.pm index 9d0989e..4ca2c37 100644 --- a/lib/Teapot/Bot/Object/Contact.pm +++ b/lib/Teapot/Bot/Object/Contact.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::Contact; # ABSTRACT: The base class for Telegram 'Contact' objects. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::Contact::VERSION = '0.022'; @@ -23,7 +28,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -37,7 +42,7 @@ version 0.022 The base class for Telegram 'Contact' objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/Dice.pm b/lib/Teapot/Bot/Object/Dice.pm index 43fd4b3..6bcde8c 100644 --- a/lib/Teapot/Bot/Object/Dice.pm +++ b/lib/Teapot/Bot/Object/Dice.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::Dice; # ABSTRACT: The base class for Telegram message 'Dice' type. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::Dice::VERSION = '0.022'; @@ -18,7 +23,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -32,7 +37,7 @@ version 0.022 The base class for Telegram message 'Dice' type. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/Document.pm b/lib/Teapot/Bot/Object/Document.pm index 45976dd..105b18a 100644 --- a/lib/Teapot/Bot/Object/Document.pm +++ b/lib/Teapot/Bot/Object/Document.pm @@ -1,9 +1,13 @@ package Teapot::Bot::Object::Document; # ABSTRACT: The base class for Telegram 'Document' objects -use Mojo::Base 'Teapot::Bot::Object::Base'; +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; -use Teapot::Bot::Object::PhotoSize; +use Mojo::Base 'Teapot::Bot::Object::Base'; +use Teapot::Bot::Object::PhotoSize (); $Teapot::Bot::Object::Document::VERSION = '0.022'; @@ -17,7 +21,7 @@ has 'file_size'; sub fields { return { scalar => [qw/file_id file_unique_id file_name mime_type file_size/], - 'Teapot::Bot::Object::PhotoSize' => [qw/thumb/] + 'Teapot::Bot::Object::PhotoSize' => [qw/thumb/], }; } @@ -27,7 +31,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -41,7 +45,7 @@ version 0.022 The base class for Telegram 'Document' objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/EncryptedCredentials.pm b/lib/Teapot/Bot/Object/EncryptedCredentials.pm index 4f90357..07272bf 100644 --- a/lib/Teapot/Bot/Object/EncryptedCredentials.pm +++ b/lib/Teapot/Bot/Object/EncryptedCredentials.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::EncryptedCredentials; # ABSTRACT: The base class for Telegram 'EncryptedCredentials' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::EncryptedCredentials::VERSION = '0.022'; @@ -19,7 +24,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -33,7 +38,7 @@ version 0.022 The base class for Telegram 'EncryptedCredentials' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/EncryptedPassportElement.pm b/lib/Teapot/Bot/Object/EncryptedPassportElement.pm index 0922a85..f382baa 100644 --- a/lib/Teapot/Bot/Object/EncryptedPassportElement.pm +++ b/lib/Teapot/Bot/Object/EncryptedPassportElement.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::EncryptedPassportElement; # ABSTRACT: The base class for Telegram 'EncryptedPassportElement' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::EncryptedPassportElement::VERSION = '0.022'; @@ -25,7 +30,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -39,7 +44,7 @@ version 0.022 The base class for Telegram 'EncryptedPassportElement' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. Note that this type is not yet fully implemented. diff --git a/lib/Teapot/Bot/Object/Game.pm b/lib/Teapot/Bot/Object/Game.pm index fec213f..12d90f3 100644 --- a/lib/Teapot/Bot/Object/Game.pm +++ b/lib/Teapot/Bot/Object/Game.pm @@ -1,11 +1,15 @@ package Teapot::Bot::Object::Game; # ABSTRACT: The base class for Telegram message 'Game' type. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::PhotoSize; -use Teapot::Bot::Object::Animation; -use Teapot::Bot::Object::MessageEntity; +use Teapot::Bot::Object::PhotoSize (); +use Teapot::Bot::Object::Animation (); +use Teapot::Bot::Object::MessageEntity (); $Teapot::Bot::Object::Game::VERSION = '0.022'; @@ -33,7 +37,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -47,7 +51,7 @@ version 0.022 The base class for Telegram message 'Game' type. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/InlineKeyboardButton.pm b/lib/Teapot/Bot/Object/InlineKeyboardButton.pm index 7256c12..14c2d59 100644 --- a/lib/Teapot/Bot/Object/InlineKeyboardButton.pm +++ b/lib/Teapot/Bot/Object/InlineKeyboardButton.pm @@ -1,9 +1,14 @@ package Teapot::Bot::Object::InlineKeyboardButton; # ABSTRACT: The base class for Telegram 'InlineKeyboardButton' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::LoginUrl; -use Teapot::Bot::Object::CallbackGame; +use Teapot::Bot::Object::LoginUrl (); +use Teapot::Bot::Object::CallbackGame (); $Teapot::Bot::Object::InlineKeyboardButton::VERSION = '0.022'; @@ -30,7 +35,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -44,7 +49,7 @@ version 0.022 The base class for Telegram 'InlineKeyboardButton' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/InlineKeyboardMarkup.pm b/lib/Teapot/Bot/Object/InlineKeyboardMarkup.pm index ff9906a..f95c4f9 100644 --- a/lib/Teapot/Bot/Object/InlineKeyboardMarkup.pm +++ b/lib/Teapot/Bot/Object/InlineKeyboardMarkup.pm @@ -1,8 +1,13 @@ package Teapot::Bot::Object::InlineKeyboardMarkup; # ABSTRACT: The base class for Telegram 'InlineKeyboardMarkup' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::InlineKeyboardButton; +use Teapot::Bot::Object::InlineKeyboardButton (); $Teapot::Bot::Object::InlineKeyboardMarkup::VERSION = '0.022'; @@ -22,7 +27,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -36,7 +41,7 @@ version 0.022 The base class for Telegram 'InlineKeyboardMarkup' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/Invoice.pm b/lib/Teapot/Bot/Object/Invoice.pm index 152dcf4..959c52a 100644 --- a/lib/Teapot/Bot/Object/Invoice.pm +++ b/lib/Teapot/Bot/Object/Invoice.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::Invoice; # ABSTRACT: The base class for Telegram 'Invoice' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::Invoice::VERSION = '0.022'; @@ -21,7 +26,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -35,7 +40,7 @@ version 0.022 The base class for Telegram 'Invoice' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/Location.pm b/lib/Teapot/Bot/Object/Location.pm index 14646e7..4b142ad 100644 --- a/lib/Teapot/Bot/Object/Location.pm +++ b/lib/Teapot/Bot/Object/Location.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::Location; # ABSTRACT: The base class for Telegram message 'Location' type. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::Location::VERSION = '0.022'; @@ -22,7 +27,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -36,7 +41,7 @@ version 0.022 The base class for Telegram message 'Location' type. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/LoginUrl.pm b/lib/Teapot/Bot/Object/LoginUrl.pm index 328e5b4..13a9797 100644 --- a/lib/Teapot/Bot/Object/LoginUrl.pm +++ b/lib/Teapot/Bot/Object/LoginUrl.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::LoginUrl; # ABSTRACT: The base class for Telegram 'LoginUrl' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::LoginUrl::VERSION = '0.022'; @@ -20,7 +25,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -34,7 +39,7 @@ version 0.022 The base class for Telegram 'LoginUrl' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/Message.pm b/lib/Teapot/Bot/Object/Message.pm index a828b13..cdacbc1 100644 --- a/lib/Teapot/Bot/Object/Message.pm +++ b/lib/Teapot/Bot/Object/Message.pm @@ -1,42 +1,44 @@ package Teapot::Bot::Object::Message; # ABSTRACT: The base class for the Telegram type "Message". +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::User; -use Teapot::Bot::Object::Chat; -use Teapot::Bot::Object::ChatMember; -use Teapot::Bot::Object::ChatPermissions; -use Teapot::Bot::Object::MessageEntity; -use Teapot::Bot::Object::Audio; -use Teapot::Bot::Object::Document; -use Teapot::Bot::Object::Animation; -use Teapot::Bot::Object::Game; -use Teapot::Bot::Object::PhotoSize; -use Teapot::Bot::Object::Sticker; -use Teapot::Bot::Object::Video; -use Teapot::Bot::Object::Voice; -use Teapot::Bot::Object::VideoNote; -use Teapot::Bot::Object::Contact; -use Teapot::Bot::Object::Location; -use Teapot::Bot::Object::Poll; -use Teapot::Bot::Object::Location; -use Teapot::Bot::Object::PhotoSize; -use Teapot::Bot::Object::Invoice; -use Teapot::Bot::Object::Venue; -use Teapot::Bot::Object::SuccessfulPayment; -use Teapot::Bot::Object::PassportData; -use Teapot::Bot::Object::InlineKeyboardMarkup; -use Teapot::Bot::Object::ProximityAlertTriggered; -use Teapot::Bot::Object::Dice; -use Teapot::Bot::Object::MessageAutoDeleteTimerChanged; -use Teapot::Bot::Object::VoiceChatScheduled; -use Teapot::Bot::Object::VoiceChatStarted; -use Teapot::Bot::Object::VoiceChatEnded; -use Teapot::Bot::Object::VoiceChatParticipantsInvited; - -use Data::Dumper; -use Carp qw(cluck); +use Teapot::Bot::Object::User (); +use Teapot::Bot::Object::Chat (); +use Teapot::Bot::Object::ChatMember (); +use Teapot::Bot::Object::ChatPermissions (); +use Teapot::Bot::Object::MessageEntity (); +use Teapot::Bot::Object::Audio (); +use Teapot::Bot::Object::Document (); +use Teapot::Bot::Object::Animation (); +use Teapot::Bot::Object::Game (); +use Teapot::Bot::Object::PhotoSize (); +use Teapot::Bot::Object::Sticker (); +use Teapot::Bot::Object::Video (); +use Teapot::Bot::Object::Voice (); +use Teapot::Bot::Object::VideoNote (); +use Teapot::Bot::Object::Contact (); +use Teapot::Bot::Object::Location (); +use Teapot::Bot::Object::Poll (); +use Teapot::Bot::Object::Location (); +use Teapot::Bot::Object::PhotoSize (); +use Teapot::Bot::Object::Invoice (); +use Teapot::Bot::Object::Venue (); +use Teapot::Bot::Object::SuccessfulPayment (); +use Teapot::Bot::Object::PassportData (); +use Teapot::Bot::Object::InlineKeyboardMarkup (); +use Teapot::Bot::Object::ProximityAlertTriggered (); +use Teapot::Bot::Object::Dice (); +use Teapot::Bot::Object::MessageAutoDeleteTimerChanged (); +use Teapot::Bot::Object::VoiceChatScheduled (); +use Teapot::Bot::Object::VoiceChatStarted (); +use Teapot::Bot::Object::VoiceChatEnded (); +use Teapot::Bot::Object::VoiceChatParticipantsInvited (); $Teapot::Bot::Object::Message::VERSION = '0.022'; @@ -200,7 +202,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -214,7 +216,7 @@ version 0.022 The base class for the Telegram type "Message". See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 METHODS @@ -222,7 +224,7 @@ attributes available for L objects. A convenience method to reply to a message with text. -Will return the L object representing the message +Will return the C object representing the message sent. =head2 typing diff --git a/lib/Teapot/Bot/Object/MessageAutoDeleteTimerChanged.pm b/lib/Teapot/Bot/Object/MessageAutoDeleteTimerChanged.pm index 3bff092..c60bfd9 100644 --- a/lib/Teapot/Bot/Object/MessageAutoDeleteTimerChanged.pm +++ b/lib/Teapot/Bot/Object/MessageAutoDeleteTimerChanged.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::MessageAutoDeleteTimerChanged; # ABSTRACT: The base class for Telegram 'MessageAutoDeleteTimerChanged' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::MessageAutoDeleteTimerChanged::VERSION = '0.022'; @@ -19,7 +24,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -33,7 +38,7 @@ version 0.022 The base class for Telegram 'MessageAutoDeleteTimerChanged' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/MessageEntity.pm b/lib/Teapot/Bot/Object/MessageEntity.pm index b05c28a..e9ada9f 100644 --- a/lib/Teapot/Bot/Object/MessageEntity.pm +++ b/lib/Teapot/Bot/Object/MessageEntity.pm @@ -1,8 +1,13 @@ package Teapot::Bot::Object::MessageEntity; # ABSTRACT: The base class for Telegram 'MessageEntity' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::User; +use Teapot::Bot::Object::User (); $Teapot::Bot::Object::MessageEntity::VERSION = '0.022'; @@ -26,7 +31,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -40,7 +45,7 @@ version 0.022 The base class for Telegram 'MessageEntity' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/PassportData.pm b/lib/Teapot/Bot/Object/PassportData.pm index e1b60a7..939e614 100644 --- a/lib/Teapot/Bot/Object/PassportData.pm +++ b/lib/Teapot/Bot/Object/PassportData.pm @@ -1,9 +1,14 @@ package Teapot::Bot::Object::PassportData; # ABSTRACT: The base class for Telegram 'PassportData' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::EncryptedPassportElement; -use Teapot::Bot::Object::EncryptedCredentials; +use Teapot::Bot::Object::EncryptedPassportElement (); +use Teapot::Bot::Object::EncryptedCredentials (); $Teapot::Bot::Object::PassportData::VERSION = '0.022'; @@ -27,7 +32,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -41,7 +46,7 @@ version 0.022 The base class for Telegram 'PassportData' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/PhotoSize.pm b/lib/Teapot/Bot/Object/PhotoSize.pm index ff61593..664f346 100644 --- a/lib/Teapot/Bot/Object/PhotoSize.pm +++ b/lib/Teapot/Bot/Object/PhotoSize.pm @@ -1,8 +1,12 @@ package Teapot::Bot::Object::PhotoSize; # ABSTRACT: The base class for Telegram message 'PhotoSize' type. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; -use Carp qw/croak/; $Teapot::Bot::Object::PhotoSize::VERSION = '0.022'; @@ -22,7 +26,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -36,7 +40,7 @@ version 0.022 The base class for Telegram message 'PhotoSize' type. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/Poll.pm b/lib/Teapot/Bot/Object/Poll.pm index 6d8bdb2..3cab8f0 100644 --- a/lib/Teapot/Bot/Object/Poll.pm +++ b/lib/Teapot/Bot/Object/Poll.pm @@ -1,8 +1,13 @@ package Teapot::Bot::Object::Poll; # ABSTRACT: The base class for Telegram 'Poll' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::PollOption; +use Teapot::Bot::Object::PollOption (); $Teapot::Bot::Object::Poll::VERSION = '0.022'; @@ -39,7 +44,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -53,7 +58,7 @@ version 0.022 The base class for Telegram 'Poll' type objects See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/PollAnswer.pm b/lib/Teapot/Bot/Object/PollAnswer.pm index 3369c27..c26c51e 100644 --- a/lib/Teapot/Bot/Object/PollAnswer.pm +++ b/lib/Teapot/Bot/Object/PollAnswer.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::PollAnswer; # ABSTRACT: The base class for Telegram 'PollOption' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::PollAnswer::VERSION = '0.022'; @@ -26,7 +31,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -40,7 +45,7 @@ version 0.022 The base class for Telegram 'PollAnswer' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/PollOption.pm b/lib/Teapot/Bot/Object/PollOption.pm index 651a88e..e1f06eb 100644 --- a/lib/Teapot/Bot/Object/PollOption.pm +++ b/lib/Teapot/Bot/Object/PollOption.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::PollOption; # ABSTRACT: The base class for Telegram 'PollOption' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::PollOption::VERSION = '0.022'; @@ -18,7 +23,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -32,7 +37,7 @@ version 0.022 The base class for Telegram 'PollOption' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/ProximityAlertTriggered.pm b/lib/Teapot/Bot/Object/ProximityAlertTriggered.pm index 245dfff..ab42e03 100644 --- a/lib/Teapot/Bot/Object/ProximityAlertTriggered.pm +++ b/lib/Teapot/Bot/Object/ProximityAlertTriggered.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::ProximityAlertTriggered; # ABSTRACT: The base class for Telegram message 'ProximityAlertTriggered' type. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::ProximityAlertTriggered::VERSION = '0.022'; @@ -22,7 +27,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -36,7 +41,7 @@ version 0.022 The base class for Telegram message 'ProximityAlertTriggered' type. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/Sticker.pm b/lib/Teapot/Bot/Object/Sticker.pm index 1b13e57..252425a 100644 --- a/lib/Teapot/Bot/Object/Sticker.pm +++ b/lib/Teapot/Bot/Object/Sticker.pm @@ -1,8 +1,13 @@ package Teapot::Bot::Object::Sticker; # ABSTRACT: The base class for Telegram message 'Sticker' type. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::PhotoSize; +use Teapot::Bot::Object::PhotoSize (); $Teapot::Bot::Object::Sticker::VERSION = '0.022'; @@ -28,7 +33,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -42,7 +47,7 @@ version 0.022 The base class for Telegram message 'Sticker' type. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/SuccessfulPayment.pm b/lib/Teapot/Bot/Object/SuccessfulPayment.pm index 6747de1..b440c63 100644 --- a/lib/Teapot/Bot/Object/SuccessfulPayment.pm +++ b/lib/Teapot/Bot/Object/SuccessfulPayment.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::SuccessfulPayment; # ABSTRACT: The base class for Telegram 'SuccessfulPayment' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; # use Teapot::Bot::Object::OrderInfo; @@ -28,7 +33,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -42,7 +47,7 @@ version 0.022 The base class for Telegram 'SuccessfulPayment' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/User.pm b/lib/Teapot/Bot/Object/User.pm index f53721f..dc6df38 100644 --- a/lib/Teapot/Bot/Object/User.pm +++ b/lib/Teapot/Bot/Object/User.pm @@ -1,6 +1,10 @@ package Teapot::Bot::Object::User; # ABSTRACT: The base class for Telegram message 'User' type. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; use Mojo::Base 'Teapot::Bot::Object::Base'; @@ -19,7 +23,7 @@ has 'supports_inline_queries'; # optional, only for getMe() method sub fields { return { scalar => [qw/id is_bot first_name last_name username language_code can_join_groups - can_read_all_group_messages supports_inline_queries/] + can_read_all_group_messages supports_inline_queries/], }; } @@ -29,7 +33,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -43,7 +47,7 @@ version 0.022 The base class for Telegram message 'User' type. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/Venue.pm b/lib/Teapot/Bot/Object/Venue.pm index 62b77d9..41259dc 100644 --- a/lib/Teapot/Bot/Object/Venue.pm +++ b/lib/Teapot/Bot/Object/Venue.pm @@ -1,8 +1,13 @@ package Teapot::Bot::Object::Venue; # ABSTRACT: The base class for Telegram 'LoginUrl' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::Location; +use Teapot::Bot::Object::Location (); $Teapot::Bot::Object::Venue::VERSION = '0.022'; @@ -17,7 +22,7 @@ has 'google_place_type'; sub fields { return { 'scalar' => [qw/title address foursquare_id foursquare_type google_place_id google_place_type/], - 'Teapot::Bot::Object::Location' => [qw/location/] + 'Teapot::Bot::Object::Location' => [qw/location/], }; } @@ -28,7 +33,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -42,7 +47,7 @@ version 0.022 The base class for Telegram 'LoginUrl' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/Video.pm b/lib/Teapot/Bot/Object/Video.pm index c4679cc..0759111 100644 --- a/lib/Teapot/Bot/Object/Video.pm +++ b/lib/Teapot/Bot/Object/Video.pm @@ -1,8 +1,13 @@ package Teapot::Bot::Object::Video; # ABSTRACT: The base class for Telegram 'Video' object. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::PhotoSize; +use Teapot::Bot::Object::PhotoSize (); $Teapot::Bot::Object::Video::VERSION = '0.022'; @@ -20,7 +25,7 @@ sub fields { return { scalar => [qw/file_id file_unique_id width height duration file_name mime_type file_size/], - 'Teapot::Bot::Object::PhotoSize' => [qw/thumb/] + 'Teapot::Bot::Object::PhotoSize' => [qw/thumb/], }; } @@ -30,7 +35,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -44,7 +49,7 @@ version 0.022 The base class for Telegram 'Video' object. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/VideoNote.pm b/lib/Teapot/Bot/Object/VideoNote.pm index 40a18ee..e469b74 100644 --- a/lib/Teapot/Bot/Object/VideoNote.pm +++ b/lib/Teapot/Bot/Object/VideoNote.pm @@ -1,9 +1,13 @@ package Teapot::Bot::Object::VideoNote; # ABSTRACT: The base class for Telegram 'VideoNote' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::PhotoSize; +use Teapot::Bot::Object::PhotoSize (); $Teapot::Bot::Object::VideoNote::VERSION = '0.022'; @@ -28,7 +32,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -42,7 +46,7 @@ version 0.022 The base class for Telegram 'VideoNote' type object. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/Voice.pm b/lib/Teapot/Bot/Object/Voice.pm index 72fe4f0..1ff438a 100644 --- a/lib/Teapot/Bot/Object/Voice.pm +++ b/lib/Teapot/Bot/Object/Voice.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::Voice; # ABSTRACT: The base class for Telegram 'Voice' type objects +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::Voice::VERSION = '0.022'; @@ -21,7 +26,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -35,7 +40,7 @@ version 0.022 The base class for Telegram 'Voice' type objects. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/VoiceChatEnded.pm b/lib/Teapot/Bot/Object/VoiceChatEnded.pm index 600922a..693f6e7 100644 --- a/lib/Teapot/Bot/Object/VoiceChatEnded.pm +++ b/lib/Teapot/Bot/Object/VoiceChatEnded.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::VoiceChatEnded; # ABSTRACT: The base class for Telegram message 'VoiceChatEnded' type. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::VoiceChatEnded::VERSION = '0.022'; @@ -18,7 +23,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -32,7 +37,7 @@ version 0.022 The base class for Telegram message 'VoiceChatEnded' type. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/VoiceChatParticipantsInvited.pm b/lib/Teapot/Bot/Object/VoiceChatParticipantsInvited.pm index cf61dbd..065c32b 100644 --- a/lib/Teapot/Bot/Object/VoiceChatParticipantsInvited.pm +++ b/lib/Teapot/Bot/Object/VoiceChatParticipantsInvited.pm @@ -1,8 +1,13 @@ package Teapot::Bot::Object::VoiceChatParticipantsInvited; # ABSTRACT: The base class for Telegram message 'VoiceChatParticipantsInvited' type. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; -use Teapot::Bot::Object::User; +use Teapot::Bot::Object::User (); $Teapot::Bot::Object::VoiceChatParticipantsInvited::VERSION = '0.022'; @@ -23,7 +28,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -37,7 +42,7 @@ version 0.022 The base class for Telegram message 'VoiceChatParticipantsInvited' type. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/VoiceChatScheduled.pm b/lib/Teapot/Bot/Object/VoiceChatScheduled.pm index 7feffdf..142fef3 100644 --- a/lib/Teapot/Bot/Object/VoiceChatScheduled.pm +++ b/lib/Teapot/Bot/Object/VoiceChatScheduled.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::VoiceChatScheduled; # ABSTRACT: The base class for Telegram message 'VoiceChatEnded' type. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::VoiceChatScheduled::VERSION = '0.022'; @@ -18,7 +23,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -32,7 +37,7 @@ version 0.022 The base class for Telegram message 'VoiceChatScheduled' type. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/Teapot/Bot/Object/VoiceChatStarted.pm b/lib/Teapot/Bot/Object/VoiceChatStarted.pm index 74b3097..54ade67 100644 --- a/lib/Teapot/Bot/Object/VoiceChatStarted.pm +++ b/lib/Teapot/Bot/Object/VoiceChatStarted.pm @@ -1,6 +1,11 @@ package Teapot::Bot::Object::VoiceChatStarted; # ABSTRACT: The base class for Telegram message 'VoiceChatStarted' type. +use strict; +use warnings; +use 5.018; ## no critic (ProhibitImplicitImport) +use utf8; + use Mojo::Base 'Teapot::Bot::Object::Base'; $Teapot::Bot::Object::VoiceChatStarted::VERSION = '0.022'; @@ -18,7 +23,7 @@ __END__ =pod -=encoding UTF-8 +=encoding utf8 =head1 NAME @@ -32,7 +37,7 @@ version 0.022 The base class for Telegram message 'VoiceChatStarted' type. See L for details of the -attributes available for L objects. +attributes available for C objects. =head1 AUTHOR diff --git a/lib/TelegramBot.pm b/lib/TelegramBot.pm index 9c4f00a..3374950 100644 --- a/lib/TelegramBot.pm +++ b/lib/TelegramBot.pm @@ -1,15 +1,13 @@ package TelegramBot; # main bot gears are here -use 5.018; +use 5.018; ## no critic (ProhibitImplicitImport) use strict; use warnings; use utf8; use open qw (:std :utf8); use English qw ( -no_match_vars ); -use Carp qw (cluck carp); use Clone qw (clone); -use File::Path qw (make_path); use Log::Any qw ($log); use Math::Random::Secure qw (irand); use Mojo::Base 'Teapot::Bot::Brain'; @@ -18,7 +16,7 @@ use BotLib::Admin qw (FortuneToggleList ChanMsgEnabled); use BotLib qw (Command Highlight BotSleep IsCensored); use BotLib::Conf qw (LoadConf); use BotLib::Util qw (trim fmatch); -use RedisLib qw (redis_parse_message redis_events_listener); +use RedisLib qw (redis_events_listener); use version; our $VERSION = qw (1.0); use Exporter qw (import); @@ -67,7 +65,7 @@ sub __cron { $rmsg->{chatid} = $enabledfortunechat; $pubsub->json ($c->{'redis_router_channel'})->notify ( - $c->{'redis_router_channel'} => $rmsg + $c->{'redis_router_channel'} => $rmsg, ); } } @@ -81,7 +79,7 @@ sub __on_msg { my $chatid; my $chatname = 'Noname chat'; # user sending message info - my ($userid, $username, $fullname, $highlight, $vis_a_vi) = BotLib::Highlight ($msg); + my ($userid, $username, $fullname, $highlight, $vis_a_vi) = Highlight ($msg); my $csign = $c->{telegrambot}->{csign}; unless ($myid) { @@ -161,7 +159,7 @@ sub __on_msg { } push @members, sprintf '[%s](tg://user?id=%s)', $member_str, $member->id; - }; + } if ($#members > 1) { my $lastone = pop @members; @@ -197,7 +195,7 @@ sub __on_msg { $rmsg->{chatid} = $userid; my $pubsub = $main::REDIS->pubsub; $pubsub->json ($c->{'redis_router_channel'})->notify ( - $c->{'redis_router_channel'} => $rmsg + $c->{'redis_router_channel'} => $rmsg, ); return; @@ -289,7 +287,7 @@ sub __on_msg { my $pubsub = $main::REDIS->pubsub; $pubsub->json ($c->{'redis_router_channel'})->notify ( - $c->{'redis_router_channel'} => $rmsg + $c->{'redis_router_channel'} => $rmsg, ); return; @@ -337,7 +335,7 @@ sub __on_msg { my $pubsub = $main::REDIS->pubsub; $pubsub->json ($c->{'redis_router_channel'})->notify ( - $c->{'redis_router_channel'} => $rmsg + $c->{'redis_router_channel'} => $rmsg, ); return; @@ -408,7 +406,7 @@ sub RunTelegramBot { while (sleep 3) { eval { ## no critic (ErrorHandling::RequireCheckingReturnValueOfEval) TelegramBot->new->think; - } + }; } return;