App-SpreadRevolutionaryDate

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

lib/App/SpreadRevolutionaryDate/Target/Freenode/Bot.pm
lib/App/SpreadRevolutionaryDate/Target/Liberachat.pm
lib/App/SpreadRevolutionaryDate/Target/Liberachat/Bot.pm
lib/App/SpreadRevolutionaryDate/Target/Mastodon.pm
lib/App/SpreadRevolutionaryDate/Target/Twitter.pm
lib/LocaleData/de/LC_MESSAGES/App-SpreadRevolutionaryDate.mo
lib/LocaleData/en/LC_MESSAGES/App-SpreadRevolutionaryDate.mo
lib/LocaleData/es/LC_MESSAGES/App-SpreadRevolutionaryDate.mo
lib/LocaleData/fr/LC_MESSAGES/App-SpreadRevolutionaryDate.mo
lib/LocaleData/it/LC_MESSAGES/App-SpreadRevolutionaryDate.mo
share/images/blanqui.png
share/images/coluche_macron.png
share/images/groucha.png
t/00-compile.t
t/bluesky.t
t/command_line.t
t/config.t
t/locale.t
t/mastodon.t
t/new_target.t
t/objects.t
t/promptuser.t
t/telechat.t

README  view on Meta::CPAN

    
      # Spread message and image as command line parameter to
      # Mastodon and Bluesky
      $ spread-revolutionary-date \
          --msgmaker=UserPrompt \
          --targets=Mastodon \
          --targets=Bluesky \
          --promptuser_default \
            'This is my message to the world'
          --promptuser_img_path= \
            /my/path/to/image.png
          --promptuser_img_alt= \
            'Alternative text for image'
    
      # Spread message and image form web as command line parameter to
      # Mastodon and Bluesky
      $ spread-revolutionary-date \
          --msgmaker=UserPrompt \
          --targets=Mastodon \
          --targets=Bluesky \
          --promptuser_default \

README  view on Meta::CPAN

      $ spread-revolutionary-date \
          --targets=Mastodon \
          --msgmaker=Gemini \
          --gemini_api_key=ApiKey \
          --gemini_process=MacronJokeColuche \
          --gemini_prompt 'MacronJokeColuche=Invente-moi une blague \
            dans le style de Coluche sur Emmanuel Macron. Pas besoin \
            de dire "D\'accord, voici une blague" ou "Bien sûr, \
            voici une blague dans le style de Coluche sur Emmanuel \
            Macron" avant la blague.' \
          --gemini_img_path "MacronJokeColuche='/my/path/to/image.png'" \
          --gemini_img_alt "MacronJokeColuche='Caricature de Coluche \
            disant : « C’est l’histoire d’un mec… » avec une caricature \
            de macron'" \
    
      # Spread Gemini searching for real time weather on Mastodon
      # NB: usually prompts are defined in configuration file along
      # with api_key, while --gemini-process is passed on command line
      # to choose which prompt to process
      $ spread-revolutionary-date \
          --targets=Mastodon \

README  view on Meta::CPAN

    This way, you can setup different prompts in your configuration file.
    Here is an example with 4 different prompts configured:

      [Gemini]
      # See https://ai.google.dev/gemini-api/docs/api-key
      api_key                      = 'GEMINI_API_KEY'
      prompt   FamousBirthday      = 'Which famous people have their birthday on $month_name $day? Give a list of up to 6 people, then after the list give the unformatted URL of the Wikipedia page of only one of them, no comments and no need for an i...
      intro    FamousBirthday      = 'FamousBirthday=Famous people born on $month_name $day for better or for worse:'
    
      prompt   MacronJokeColuche   = 'Invente-moi une blague dans le style de Coluche sur Emmanuel Macron. Pas besoin de dire "D\'accord, voici une blague" ou "Bien sûr, voici une blague dans le style de Coluche sur Emmanuel Macron" avant la blague....
      img_path MacronJokeColuche   = '/usr/local/share/perl/5.32.1/auto/share/dist/App-SpreadRevolutionaryDate/images/coluche_macron.png'
      img_alt  MacronJokeColuche   = 'Caricature de Coluche disant : « C’est l’histoire d’un mec… » avec une caricature de macron'
    
      prompt   BlanquiRevival      = 'Invente-moi un dicton révolutionnaire dans le style d\'Auguste Blanqui. Ne fais pas d\'introduction.'
      img_url  BlanquiRevival      = 'https://example.com/imgs/my_image.jgp'
    
      prompt   MeteoParis          = 'Quelle est la météo aujourd\'hui à Paris, avec la température, selon meteo-paris.com, ne devine pas, va chercher l\'information.'
      search   MeteoParis          =  1

    and, then choose the prompt to use at execution time, like:

SIGNATURE  view on Meta::CPAN

SHA256 3d7da5e51e6f0e3ec927fb1a2befdb17369fec0a5dd23281c23dc8f3f0e53766 lib/App/SpreadRevolutionaryDate/Target/Freenode/Bot.pm
SHA256 e591afdac0d6f2c7f3f6e2a00c787be2237ac1808108eb6a24d748df8bdcea7e lib/App/SpreadRevolutionaryDate/Target/Liberachat.pm
SHA256 5c42196a83676730513b0b9d0defe0f1fb84a60c1cc686cc0fe991c7295007e4 lib/App/SpreadRevolutionaryDate/Target/Liberachat/Bot.pm
SHA256 bd46638f18dadb9e4853f058edbffa2b23ed961ec619d493a751a443c9c5a259 lib/App/SpreadRevolutionaryDate/Target/Mastodon.pm
SHA256 748b97e8ae3a2bd002c576eb73609f142dab9199a70aac103ec39658d20374fd lib/App/SpreadRevolutionaryDate/Target/Twitter.pm
SHA256 ff63385446d651ea007d7431f24d36fef5fbb97979d656bb6a4bc4f43db76eb0 lib/LocaleData/de/LC_MESSAGES/App-SpreadRevolutionaryDate.mo
SHA256 bda723d14e43753c0aa0d864abba3c7c89b2bfb7f5f9480b45376cc1ec6c1eef lib/LocaleData/en/LC_MESSAGES/App-SpreadRevolutionaryDate.mo
SHA256 0d1659099f721211a2d3f3b6d92ce3a6dbc7bd9fed9a9a9a10fcf3de24a0303a lib/LocaleData/es/LC_MESSAGES/App-SpreadRevolutionaryDate.mo
SHA256 57f0e95e42b1a8e91da33f78f1297eab85a0aabd0d6f00aa2414811030c8deca lib/LocaleData/fr/LC_MESSAGES/App-SpreadRevolutionaryDate.mo
SHA256 1f40141da10af2f3acb6e75c168ab606274aa9d657c22a0c5e7eca4675fc5107 lib/LocaleData/it/LC_MESSAGES/App-SpreadRevolutionaryDate.mo
SHA256 3b6202afdb638eb807a4ddee53d1b3e46d4defa29b6440f527688067d48ef486 share/images/blanqui.png
SHA256 526bbeb3ac4598d7d26141a750ad99d5f7471b024e3020a95f618d40400af910 share/images/coluche_macron.png
SHA256 47102885766ef282deffe12bd468e596163a960b1fa1656171a902e988d365d5 share/images/groucha.png
SHA256 ed3ec364e28e79a10ac403ea47d87756eae751ba10409e293be24a404f8cfa87 t/00-compile.t
SHA256 5bdd8d62693984a7904152048e175e3d1fdb356b6c9896f87afa28d266234bc9 t/bluesky.t
SHA256 bdf0ca7f2bfd2216fae1a2c4a60f31925930d0a24551b7cfce01846640e0b2ea t/command_line.t
SHA256 2d7c00d4dc592592a7b705879957a5858e51ed5c353aa0eb5f8df4daae23fcbb t/config.t
SHA256 23fec6d51b26f654a879139c56ca67d8eb38e06c1f40f4920a1dc8b1b11f0d52 t/locale.t
SHA256 58913ef0354246be4289c61d238a57f32c95556a5579ee770540021c4ff47eb9 t/mastodon.t
SHA256 115371bb2369438a0c11f11e798eb0bd98a0c4bf341d33d3c8e807ffd59f98c1 t/new_target.t
SHA256 21dcedfebfb6f99d618ca6dc0960e5860a685ddc1a0181b1d1aef446e517275c t/objects.t
SHA256 a5f2dc6aa4e3196e0669ddf284ca8b817331d8370f4d846a09254e2dc4c1e166 t/promptuser.t
SHA256 71b57d81a38a4fa94aa21c8faad2efc3284ba53c2f02e0ac4c5d992dc4977cc0 t/telechat.t

bin/spread-revolutionary-date  view on Meta::CPAN


  # Spread message and image as command line parameter to
  # Mastodon and Bluesky
  $ spread-revolutionary-date \
      --msgmaker=UserPrompt \
      --targets=Mastodon \
      --targets=Bluesky \
      --promptuser_default \
        'This is my message to the world'
      --promptuser_img_path= \
        /my/path/to/image.png
      --promptuser_img_alt= \
        'Alternative text for image'

  # Spread message and image form web as command line parameter to
  # Mastodon and Bluesky
  $ spread-revolutionary-date \
      --msgmaker=UserPrompt \
      --targets=Mastodon \
      --targets=Bluesky \
      --promptuser_default \

bin/spread-revolutionary-date  view on Meta::CPAN

  $ spread-revolutionary-date \
      --targets=Mastodon \
      --msgmaker=Gemini \
      --gemini_api_key=ApiKey \
      --gemini_process=MacronJokeColuche \
      --gemini_prompt 'MacronJokeColuche=Invente-moi une blague \
        dans le style de Coluche sur Emmanuel Macron. Pas besoin \
        de dire "D\'accord, voici une blague" ou "Bien sûr, \
        voici une blague dans le style de Coluche sur Emmanuel \
        Macron" avant la blague.' \
      --gemini_img_path "MacronJokeColuche='/my/path/to/image.png'" \
      --gemini_img_alt "MacronJokeColuche='Caricature de Coluche \
        disant : « C’est l’histoire d’un mec… » avec une caricature \
        de macron'" \

  # Spread Gemini searching for real time weather on Mastodon
  # NB: usually prompts are defined in configuration file along
  # with api_key, while --gemini-process is passed on command line
  # to choose which prompt to process
  $ spread-revolutionary-date \
      --targets=Mastodon \

bin/spread-revolutionary-date  view on Meta::CPAN


This way, you can setup different prompts in your configuration file. Here is an example with 4 different prompts configured:

  [Gemini]
  # See https://ai.google.dev/gemini-api/docs/api-key
  api_key                      = 'GEMINI_API_KEY'
  prompt   FamousBirthday      = 'Which famous people have their birthday on $month_name $day? Give a list of up to 6 people, then after the list give the unformatted URL of the Wikipedia page of only one of them, no comments and no need for an intro...
  intro    FamousBirthday      = 'FamousBirthday=Famous people born on $month_name $day for better or for worse:'

  prompt   MacronJokeColuche   = 'Invente-moi une blague dans le style de Coluche sur Emmanuel Macron. Pas besoin de dire "D\'accord, voici une blague" ou "Bien sûr, voici une blague dans le style de Coluche sur Emmanuel Macron" avant la blague.'
  img_path MacronJokeColuche   = '/usr/local/share/perl/5.32.1/auto/share/dist/App-SpreadRevolutionaryDate/images/coluche_macron.png'
  img_alt  MacronJokeColuche   = 'Caricature de Coluche disant : « C’est l’histoire d’un mec… » avec une caricature de macron'

  prompt   BlanquiRevival      = 'Invente-moi un dicton révolutionnaire dans le style d\'Auguste Blanqui. Ne fais pas d\'introduction.'
  img_url  BlanquiRevival      = 'https://example.com/imgs/my_image.jgp'

  prompt   MeteoParis          = 'Quelle est la météo aujourd\'hui à Paris, avec la température, selon meteo-paris.com, ne devine pas, va chercher l\'information.'
  search   MeteoParis          =  1

and, then choose the prompt to use at execution time, like:

dist.ini  view on Meta::CPAN

version = 0.54

; -- static meta-information
[Homepage]
[Bugtracker]
[Repository]

; -- fetch & generate files
[Encoding]
encoding = bytes
match    = png
[GatherDir]
exclude_filename = LICENSE
exclude_filename = INSTALL
exclude_filename = MANIFEST
exclude_filename = Changes
exclude_filename = Makefile.PL
exclude_filename = META.json
exclude_filename = META.yml
exclude_filename = SIGNATURE
prune_directory  = LocaleData

etc/sample-spread-revolutionary-date.conf  view on Meta::CPAN

[RevolutionaryDate]
acab

[Gemini]
# See https://ai.google.dev/gemini-api/docs/api-key
api_key                      = 'api_key'
prompt   FamousBirthday  = 'Which famous people have their birthday on $month_name $day ? Give a list of up to 6 people, then after the list give the unformatted URL of the Wikipedia page of only one of them, no comments and no need for an introducti...
intro    FamousBirthday  = 'FamousBirthday=Famous people born on $month_name $day for better or for worse:'

prompt   MacronJokeColuche   = 'Invente-moi une blague dans le style de Coluche sur Emmanuel Macron. Pas besoin de dire "D\'accord, voici une blague" ou "Bien sûr, voici une blague dans le style de Coluche sur Emmanuel Macron" avant la blague.'
img_path MacronJokeColuche   = '/usr/local/share/perl/5.32.1/auto/share/dist/App-SpreadRevolutionaryDate/images/coluche_macron.png'
img_alt  MacronJokeColuche   = 'Caricature de Coluche disant : « C’est l’histoire d’un mec… » avec une caricature de macron'

prompt   BlanquiRevival      = 'Invente-moi un dicton révolutionnaire dans le style d\'Auguste Blanqui. Ne fais pas d\'introduction.'
img_url  BlanquiRevival      = 'https://example.com/imgs/my_image.jgp'

prompt   MeteoParis          = 'Quelle est la météo aujourd\'hui à Paris, avec la température, selon meteo-paris.com, ne devine pas, va chercher l\'information.'
search   MeteoParis          =  1

lib/App/SpreadRevolutionaryDate/MsgMaker/Telechat.pm  view on Meta::CPAN


  if ($self->special_birthday_day && $self->special_birthday_month && $self->special_birthday_name && $today->day == $self->special_birthday_day && $today->month == $self->special_birthday_month) {
      $feast_gender = $self->special_birthday_gender eq 'm' ? 'Saint' : 'Sainte';
      $feast_singular = $self->special_birthday_name;
      $feast_plural = $self->special_birthday_plural;
      $every_gender = $self->special_birthday_gender eq 'm' ? 'tous' : 'toutes';
  }

  my $msg = sprintf("Chalut ! Aujourd'hui, %s %d, c'est la %s-%s.\nBonne fête à %s les %s !", $day_name, $today->day, $feast_gender, $feast_singular, $every_gender, $feast_plural);

  my $img_path = dist_file('App-SpreadRevolutionaryDate', 'images/groucha.png');
  my $img_alt = "Grouchat de Téléchat : « $msg »";
  $img_alt =~ s/\n+/ /g;
  my $img = {path => $img_path, alt => $img_alt};

  return ($msg, $img);
}


no Moose;
__PACKAGE__->meta->make_immutable;

t/config.t  view on Meta::CPAN


@ARGV  = ('--msgmaker=Gemini', '--test', '--gemini_process=AnniversairePeople');
seek DATA, $data_start, 0;
my $spread_gemini = App::SpreadRevolutionaryDate->new(\*DATA);
is($spread_gemini->config->gemini_process, 'AnniversairePeople', 'Gemini process option value');
my @gemini_prompt_keys = sort keys %{$spread_gemini->config->gemini_prompt};
is_deeply(\@gemini_prompt_keys, ['AnniversairePeople', 'MacronJokeColuche'], 'Gemini prompt option keys');
like($spread_gemini->config->gemini_prompt->{AnniversairePeople}, qr/^Quelles sont les personalit.s ayant leurs anniversaire le /, 'Gemini promt option value');
ok($spread_gemini->config->gemini_search->{MacronJokeColuche}, 'Gemini search set');
ok(!$spread_gemini->config->gemini_search->{AnniversairePeople}, 'Gemini search unset');
is($spread_gemini->config->gemini_img_path->{MacronJokeColuche}, '~/Images/coluche_macron.png', 'Gemini img path');
is($spread_gemini->config->gemini_img_url->{MacronJokeColuche}, 'https://upload.wikimedia.org/wikipedia/commons/3/38/Emmanuel_Macron_-_Caricature_%2840366024295%29.jpg', 'Gemini img url');
is($spread_gemini->config->gemini_img_alt->{MacronJokeColuche}, 'Caricature de Coluche disant : « C’est l’histoire d’un mec… » avec une caricature de macron', 'Gemini img alt');
__DATA__

[bluesky]
# Get these values from https://bsky.app/
identifier = 'Identifier'
password   = 'Password'

[twitter]

t/config.t  view on Meta::CPAN

test_channels = '#TestChannel2'
channels      = '#Channel1'
channels      = '#Channel2'
channels      = '#Channel3'

[Gemini]
api_key                    = APIKEY
prompt AnniversairePeople  = "Quelles sont les personalités ayant leurs anniversaire le $day $month ? Donne une liste d'au maximum 6 personnes, puis après la liste donne l'URL sans formattage de la fiche wikipédia d'une seule d'entre elles, ne com...
prompt MacronJokeColuche   = "Je veux envoyer chaque jour une blague différente sur les réseaux sociaux Mastodon et Bluesky. La blague doit être chaque fois suffisamment différente, toujours dans le style de Coluche et toujours sur Emmanuel Macro...
search MacronJokeColuche   = 1
img_path MacronJokeColuche = '~/Images/coluche_macron.png'
img_url MacronJokeColuche  = 'https://upload.wikimedia.org/wikipedia/commons/3/38/Emmanuel_Macron_-_Caricature_%2840366024295%29.jpg'
img_alt MacronJokeColuche  = 'Caricature de Coluche disant : « C’est l’histoire d’un mec… » avec une caricature de macron'

t/telechat.t  view on Meta::CPAN

use File::HomeDir;


use App::SpreadRevolutionaryDate;

@ARGV = ('--test', '--mastodon', '--locale', 'en');
my $data_start = tell DATA;
my $spread_revolutionary_date = App::SpreadRevolutionaryDate->new(\*DATA);

# Default message
stdout_like { $spread_revolutionary_date->spread } qr/^(?:Message 1: )?Diffusé sur Mastodon : Chalut ! Aujourd'hui, (?:Lourdi|Pardi|Morquidi|Jourdi|Dendrevi|Sordi|Mitanche) \d+, c'est la Sainte?-[^.]+\..+Bonne.+fête.+à.+tou(?:te)?s.+les.+ !.+wi...

__DATA__

msgmaker = 'Telechat'

[mastodon]
# Get these values from https://<your mastodon instance>/settings/applications
instance        = 'Instance'
client_id       = 'ClientId'
client_secret   = 'ClientSecret'



( run in 1.865 second using v1.01-cache-2.11-cpan-df04353d9ac )