DoctorKarma/bin/doctor_agustin.pl

30 lines
753 B
Perl
Executable File

#!/usr/bin/env perl
use v5.30.0;
use strict;
use warnings;
use Data::Dumper;
use JSON;
use DoctorAgustin::Config;
use DoctorAgustin::Telegram;
use DoctorAgustin::Logger;
my $config = DoctorAgustin::Config->new;
my $logger = DoctorAgustin::Logger->new;
my $telegram =
DoctorAgustin::Telegram->new( telegram_token => $config->telegram_token );
while (1) {
my $updates = $telegram->get_updates;
for my $update ($updates->@*) {
if (exists $update->{message}{text}) {
my $message = $update->{message}{text};
my $user_id = $update->{message}{from}{id};
my $username = $update->{message}{from}{username};
$logger->log_info("'$message' received from $username:$user_id");
}
}
}