App-TeleGramma

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "Carp" : "0",
            "Config::INI::Reader" : "0.025",
            "Config::INI::Writer" : "0.025",
            "DateTime" : "0",
            "Exporter" : "0",
            "File::Spec::Functions" : "0",
            "FindBin" : "0",
            "Getopt::Long" : "0",
            "Module::Pluggable" : "5.2",
            "Mojo::Base" : "0",
            "Mojo::File" : "0",
            "Mojolicious" : "7.31",
            "Proc::Daemon" : "0",
            "Storable" : "0",

META.yml  view on Meta::CPAN

generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: App-TeleGramma
requires:
  Carp: '0'
  Config::INI::Reader: '0.025'
  Config::INI::Writer: '0.025'
  DateTime: '0'
  Exporter: '0'
  File::Spec::Functions: '0'
  FindBin: '0'
  Getopt::Long: '0'
  Module::Pluggable: '5.2'
  Mojo::Base: '0'
  Mojo::File: '0'
  Mojolicious: '7.31'
  Proc::Daemon: '0'
  Storable: '0'

Makefile.PL  view on Meta::CPAN

  "EXE_FILES" => [
    "bin/telegramma"
  ],
  "LICENSE" => "perl",
  "MIN_PERL_VERSION" => "5.010",
  "NAME" => "App::TeleGramma",
  "PREREQ_PM" => {
    "Carp" => 0,
    "Config::INI::Reader" => "0.025",
    "Config::INI::Writer" => "0.025",
    "DateTime" => 0,
    "Exporter" => 0,
    "File::Spec::Functions" => 0,
    "FindBin" => 0,
    "Getopt::Long" => 0,
    "Module::Pluggable" => "5.2",
    "Mojo::Base" => 0,
    "Mojo::File" => 0,
    "Mojolicious" => "7.31",
    "Proc::Daemon" => 0,
    "Storable" => 0,

Makefile.PL  view on Meta::CPAN

    "TESTS" => "t/*.t t/plugins/*.t t/store/*.t"
  }
);


my %FallbackPrereqs = (
  "Carp" => 0,
  "Config::INI::Reader" => "0.025",
  "Config::INI::Writer" => "0.025",
  "Data::Dumper" => 0,
  "DateTime" => 0,
  "Exporter" => 0,
  "File::Spec::Functions" => 0,
  "File::Temp" => 0,
  "FindBin" => 0,
  "Getopt::Long" => 0,
  "Module::Pluggable" => "5.2",
  "Mojo::Base" => 0,
  "Mojo::File" => 0,
  "Mojolicious" => "7.31",
  "Proc::Daemon" => 0,

lib/App/TeleGramma/Plugin/Core/YearProgress.pm  view on Meta::CPAN

package App::TeleGramma::Plugin::Core::YearProgress;
$App::TeleGramma::Plugin::Core::YearProgress::VERSION = '0.14';
# ABSTRACT: TeleGramma plugin to tell you how the year is progressing

use Mojo::Base 'App::TeleGramma::Plugin::Base';
use App::TeleGramma::BotAction::Listen;
use App::TeleGramma::Constants qw/:const/;
use DateTime;

sub synopsis {
  "Periodically remind you how depressingly fast the year is passing"
}

sub default_config {
  my $self = shift;
  return { };
}

lib/App/TeleGramma/Plugin/Core/YearProgress.pm  view on Meta::CPAN


  my $decimals = 0;

  # what was the last progress report percentage?
  my $last_pc = $self->store->hash('last')->{percentage} || sprintf("%0.${decimals}f", 0);

  # how many seconds in a year?
  my $year_seconds = 365 * 86400; # no such thing as leap year la la la

  # how many seconds are we into this year?
  my $year_start_ts = DateTime->now->truncate(to => 'year')->epoch;
  my $year_seconds_so_far = time() - $year_start_ts;

  # as a percent?
  my $percent = sprintf("%0.${decimals}f", 100 * ($year_seconds_so_far / $year_seconds));

  # has it rolled?
  if ($percent ne $last_pc) {
    # store it
    $self->store->hash('last')->{percentage} = $percent;
    $self->store->save('last');



( run in 0.397 second using v1.01-cache-2.11-cpan-05444aca049 )