App-SpreadRevolutionaryDate
view release on metacpan or search on metacpan
- Add Net::Async::HTTP 0.43 requirement since previous versions fail
- Sync README.md with commit #2568084
- Tidied up pod.
- Add Signature with Dist::Zilla
- Use File::HomeDir->my_home instead of {HOME} to please win32
- Update autogenerated git readme
- Add localization for spread message, only fr (default) or en!
- Use config objects to test targets, using directly targets may lead to
undef
- Add SEE ALSO section in all modules pods
- Fix nb tests in freenode_fake_credentials to pass Test::NoWarnings
0.05 2019-03-07T08:01:25Z
- Move test no authentication to Freenode with fake credentials in xt
- Fix escaping of greater than sign in pod formatting code
- Use warnings in App::SpreadRevolutionaryDate::Config
0.04 2019-03-06T22:24:19Z
- Add clean-namespace and unused-vars tests in MANIFEST
- #128733 Add Net::OAuth 0.25 dependency
- Add Test::UnusedVars
- Add Test::CleanNamespaces
- Auto generate minimum perl version using plugin [MinimumPerlFast].
- Redirect STDERR to /dev/null *only* inside Freenode bot
- Die if configuration parameter are missing for desired targets
- Add tests for spreading to Freenode
- Shutdown Freenode bot after some timeout
- Add optional argument to App::SpreadRevolutionaryDate::spread for
testing multiple Freenode bots
- Add documentation about optional argument to
App::SpreadRevolutionaryDate constructor
- Add tests for spreading to Mastodon
- Add tests for spreading to Twitter
- Test authentication to Freenode with actual credentials in user config
- Test no authentication on Freenode with fake credentials
- Test no authentication on Mastodon with fake credentials
- Move authentication to Freenode to spread method
- Move subclass of Bot::BasicBot outside of
App::SpreadRevolutionaryDate::Freenode
- Disable coerce_entities since Mastodon::Client has trouble coercing
Account
- Using ssl on Freenode requires POE::Component::SSLify
- Fix Bot::BasicBot methods calls
- Add abstract for subclasses
- Test Freenode configuration options
- Test Mastodon configuration options
- Test setting explicit target as command line argument
- Rename authentication test with actual credentials in user config
- Test authentication to Mastodon with actual credentials in user config
- Test setting option as command line argument
- Add pod documentation for methods
- Disable pod coverage tests for now
- Add tests for spreading objects with actual credentials in user config
- Test no authentication on Twitter with fake credentials
- Add fake configuration for tests
- Rename test file
- Switch to ExtUtils::MakeMaker instead of Module::Build::Tiny
- Add no warnings test for spreading objects
- Add tests for spreading objects
- Add tests for config
- Add submodule to handle config
- Add submodule to spread on Freenode
- Add submodule to spread on Mastodon
- Add submodule to spread on Twitter
names based on nature, each day of the year, instead of being named
after an associated saint, had a unique name associated with the rural
economy: agricultural tools, common animals, grains, pastures, trees,
roots, flowers, fruits, plants, and minerals. But this was also an
attempt to give more rational in measuring Time, basing measures on
decimal system. Instead of weeks, each month was divided into exactly 3
décades, that is ten days; days were divided into ten hours; hours into
100 minutes; and minutes into 100 seconds.
You must have a registered account on each of the targets you want to
spread the revolutionary date. And you must get credentials for
spread-revolutionary-date to post on Mastodon, Bluesky and Twitter, and
also for IA generated messages with Gemini message maker. Finally, you
have to configure spread-revolutionary-date to use these credentials,
see "CONFIGURATION" and "COMMAND LINE PARAMETERS" below.
The revolutionary date and time is computed thanks to the
DateTime::Calendar::FrenchRevolutionary Perl module, by Jean Forget.
USAGE
# Just execute the script in your shell
# to spread current date to configured accounts
# to Bluesky, Twitter, Mastodon, Freenode and Liberachat:
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 introduction like "Here are some famous people".' \
--gemini_intro 'FamousBirthday=Famous people born on $month_name \
$day for better or for worse:'
CONFIGURATION
Once again: you have to configure spread-revolutionary-date with
credentials for registered account on each of the desired targets and
also for Gemini message maker, so it can spread the revolutionary date
or an IA generated message on behalf of these accounts.
Configuration options may also be specified as command line parameters,
see "COMMAND LINE PARAMETERS" below, which take precedence on options
of the configuration file.
The configuration file should lie on
~/.config/spread-revolutionary-date/spread-revolutionary-date.conf or
~/.spread-revolutionary-date.conf. In case a file is found on both
test
This boolean option takes no value, either it is defined or not. If
defined, do not actually spread the revolutionary date, just print it
on standard output for Mastodon, Bluesky and Twitter, and send it on
configured test channels for Liberachat and Freenode (see
"test_channels" below).
Mastodon options
These options are credentials for spread-revolutionary-date to spread
on a Mastodon account. You have to get them from your Mastodon instance
API account <https://mstdn.fr/settings/applications> with write scope.
Note that Mastodon is a decentralized network with multiple instances,
the previous link is for mstdn.fr instance, please replace url with
your preferred instance. They should be defined in the [mastodon]
section of the configuration file.
instance
This option can only be specified once, with a value as string: the
This option can only be specified once, with a value as string: your
Mastodon Client secret for this application.
access_token
This option can only be specified once, with a value as string: your
Mastodon Access token for this application.
Bluesky options
These options are credentials for spread-revolutionary-date to spread
on a Bluesky account. You have to get them from your Bluesky account
<https://bsky.app/>. They should be defined in the [bluesky] section of
the configuration file.
identifier
This option can only be specified once, with a value as string: your
Bluesky identifier (ending with .bsky.social by default).
password
This option can only be specified once, with a value as string: your
Bluesky password. You can define a special password for this
application, in order to not use your main Bluesky password in your
Bluesky account settings <https://bsky.app/settings/app-passwords>.
Twitter options
These options are credentials for spread-revolutionary-date to spread
on a Twitter account. You have to get them from your Twitter API
account <https://apps.twitter.com/> with write access level. They
should be defined in the [twitter] section of the configuration file.
consumer_key
This option can only be specified once, with a value as string: your
Twitter Consumer API key for this application.
consumer_secret
This option can only be specified once, with a value as string: your
Twitter Access token for this application.
access_token_secret
This option can only be specified once, with a value as string: your
Twitter Access token secret for this application.
Liberachat options
The first two options are credentials for spread-revolutionary-date to
spread on a Liberachat account. See
https://libera.chat/guides/registration to find out how to register an
account on Liberachat. They should be defined in the [liberachat]
section of the configuration file.
nickname
This option can only be specified once, with a value as string: your
Liberachat nickname.
test_channels
This option can be specified multiple times, with values as strings.
spread-revolutionary-date will spread on every channel specified with
this option. This option should be specified at least one time if
"test" option is set. It is ignored if "test" option is not set.
Freenode options
The first two options are credentials for spread-revolutionary-date to
spread on a Freenode account. See
https://freenode.net/kb/answer/registration to find out how to register
an account on Freenode. They should be defined in the [freenode]
section of the configuration file.
nickname
This option can only be specified once, with a value as string: your
Freenode nickname.
--locale=<fr|en|it|es> | -l <fr|en|it|es>
Same as "locale" configuration option above.
--test | --no | -n
Same as "test" configuration option above.
Mastodon parameters
These parameters specify credentials for spread-revolutionary-date to
spread on a Mastodon account. You have to get them from your Mastodon
instance API account <https://mstdn.fr/settings/applications> with
write scope. Note that Mastodon is a decentralized network with
multiple instances, the previous link is for mstdn.fr instance, please
replace url with your preferred instance.
--mastodon_instance=<instance> | -mi <instance>
Same as "instance" configuration option above.
--mastodon_client_secret)<secret> | -mcs <secret>
Same as "client_secret" configuration option above.
--mastodon_access_token=<token> | -mat <token>
Same as "access_token" configuration option above.
Bluesky parameters
These parameters specify credentials for spread-revolutionary-date to
spread on a Bluesky account. You have to get them from your Bluesky
account <https://bsky.app/>.
--bluesky_identifier=<identifier> | -bi <identifier>
Same as "identifier" configuration option above.
--bluesky_password=<password> | -bp <password>
Same as "password" configuration option above.
Twitter parameters
These parameters specify credentials for spread-revolutionary-date to
spread on a Twitter account. You have to get them from your Twitter API
account <https://apps.twitter.com/> with write access level.
--twitter_consumer_key=<key> | -tck <key>
Same as "consumer_key" configuration option above.
--twitter_consumer_secret=<secret> | -tcs <secret>
Same as "consumer_secret" configuration option above.
--twitter_access_token=<token> | -tat <token>
Same as "access_token" configuration option above.
--twitter_access_token_secret=<token secret> | -tats <token secret>
Same as "access_token_secret" configuration option above.
Liberachat parameters
The first two parameters are credentials for spread-revolutionary-date
to spread on a Liberachat account. See
https://libera.chat/guides/registration to find out how to register an
account on Liberachat.
--liberachat_nickname=<nick> | -ln <nick>
Same as "nickname" configuration option above.
--liberachat_password=<passwd> | -lp <passwd>
--liberachat_channels=<channel> | -lc <channel>
Same as "channels" configuration option above.
--liberachat_test_channels=<channel> | -ltc <channel>
Same as "test_channels" configuration option above.
Freenode parameters
The first two parameters are credentials for spread-revolutionary-date
to spread on a Freenode account. See
https://freenode.net/kb/answer/registration to find out how to register
an account on Freenode.
--freenode_nickname=<nick> | -fn <nick>
Same as "nickname" configuration option above.
--freenode_password=<passwd> | -fp <passwd>
and, then choose the prompt to use at execution time, like:
$ spread-revolutionary-date --msgmaker=Gemini --gemini_process=FamousBirthday --locale=en
$ spread-revolutionary-date --msgmaker=Gemini --gemini_process=MacronJokeColuche
$ spread-revolutionary-date --msgmaker=Gemini --gemini_process=BlanquiRevival
$ spread-revolutionary-date --msgmaker=Gemini --gemini_process=MeteoParis
These examples show how you can tweak your message to be spread. Let's
review all these options:
First, you have to define credentials to use the Gemini API, by
defining the "api_key" option. For this you need to get a Gemini API
key, by following instructions on
https://ai.google.dev/gemini-api/docs/api-key.
Then for each prompt, you have to choose an identifier, which is one
word in camel case, like FamousBirthday, MacronJokeColuche,
BlanquiRevival or MeteoParis. This prompt identifier should be the
value of the --gemini_process <ThisPrompt> command line parameter.
All other options are relative to one particular prompt, and therefore
bin/spread-revolutionary-date view on Meta::CPAN
version 0.51
=head1 DESCRIPTION
C<spread-revolutionary-date> is a L<Free Software|https://www.gnu.org/philosophy/free-sw.html> that spreads the current date, expressed in the L<French Revolutionary calendar|https://en.wikipedia.org/wiki/French_Republican_calendar>, to various socia...
Moreover, you can easily extend these defaults targets with any desired one, see L</"EXTENDING TO NEW TARGETS">, and even spread something else than the revolutionary date, see L</msgmaker> option and L</"EXTENDING TO NEW MESSAGE MAKERS">.
The French Revolutionary calendar, also called Republican calendar, was introduced during the L<French Revolution|https://en.wikipedia.org/wiki/French_Revolution>, and used from late 1793 to 1805, and also during the L<Paris Commune|https://en.wikipe...
You B<must> have a registered account on each of the targets you want to spread the revolutionary date. And you must get credentials for C<spread-revolutionary-date> to post on C<Mastodon>, C<Bluesky> and C<Twitter>, and also for IA generated message...
The revolutionary date and time is computed thanks to the L<DateTime::Calendar::FrenchRevolutionary> Perl module, by Jean Forget.
=head1 USAGE
# Just execute the script in your shell
# to spread current date to configured accounts
# to Bluesky, Twitter, Mastodon, Freenode and Liberachat:
$ spread-revolutionary-date
bin/spread-revolutionary-date view on Meta::CPAN
--gemini_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 introduction like "Here are some famous people".' \
--gemini_intro 'FamousBirthday=Famous people born on $month_name \
$day for better or for worse:'
=head1 CONFIGURATION
Once again: you B<have to> configure C<spread-revolutionary-date> with credentials for registered account on each of the desired targets and also for I<Gemini> message maker, so it can spread the revolutionary date or an IA generated message on behal...
Configuration options may also be specified as command line parameters, see L</"COMMAND LINE PARAMETERS"> below, which take precedence on options of the configuration file.
The configuration file should lie on C<~/.config/spread-revolutionary-date/spread-revolutionary-date.conf> or C<~/.spread-revolutionary-date.conf>. In case a file is found on both paths, the second one is ignored. The configuration file should use th...
=head2 General options
These options should appear outside of any section of the configuration file.
=head3 targets
bin/spread-revolutionary-date view on Meta::CPAN
=head3 locale
This option can only be specified once, with a value as string. Spreads with chosen language. As of L<App::SpreadRevolutionaryDate> 0.11 locale is limited to C<'fr'>, C<'en'>, C<'it'> or C<'es'> for C<RevolutionaryDate> and C<'fr'>, C<'en'>, C<'it'>,...
=head3 test
This boolean option takes no value, either it is defined or not. If defined, do not actually spread the revolutionary date, just print it on standard output for C<Mastodon>, C<Bluesky> and C<Twitter>, and send it on configured test channels for C<Lib...
=head2 Mastodon options
These options are credentials for C<spread-revolutionary-date> to spread on a Mastodon account. You have to get them from your L<Mastodon instance API account|https://mstdn.fr/settings/applications> with C<write> scope. Note that Mastodon is a decent...
=head3 instance
This option can only be specified once, with a value as string: the domain name of your instance, eg: C<mastodon.social>, C<mstdn.fr>, etc.
=head3 client_id
This option can only be specified once, with a value as string: your Mastodon Client key for this application.
=head3 client_secret
This option can only be specified once, with a value as string: your Mastodon Client secret for this application.
=head3 access_token
This option can only be specified once, with a value as string: your Mastodon Access token for this application.
=head2 Bluesky options
These options are credentials for C<spread-revolutionary-date> to spread on a Bluesky account. You have to get them from your L<Bluesky account|https://bsky.app/>. They should be defined in the C<[bluesky]> section of the configuration file.
=head3 identifier
This option can only be specified once, with a value as string: your Bluesky identifier (ending with C<.bsky.social> by default).
=head3 password
This option can only be specified once, with a value as string: your Bluesky password. You can define a special password for this application, in order to not use your main Bluesky password in your L<Bluesky account settings|https://bsky.app/settings...
=head2 Twitter options
These options are credentials for C<spread-revolutionary-date> to spread on a Twitter account. You have to get them from your L<Twitter API account|https://apps.twitter.com/> with C<write> access level. They should be defined in the C<[twitter]> sect...
=head3 consumer_key
This option can only be specified once, with a value as string: your Twitter Consumer API key for this application.
=head3 consumer_secret
This option can only be specified once, with a value as string: your Twitter Consumer API secret key for this application.
=head3 access_token
This option can only be specified once, with a value as string: your Twitter Access token for this application.
=head3 access_token_secret
This option can only be specified once, with a value as string: your Twitter Access token secret for this application.
=head2 Liberachat options
The first two options are credentials for C<spread-revolutionary-date> to spread on a Liberachat account. See L<https://libera.chat/guides/registration> to find out how to register an account on Liberachat. They should be defined in the C<[liberachat...
=head3 nickname
This option can only be specified once, with a value as string: your Liberachat nickname.
=head3 password
This option can only be specified once, with a value as string: your Liberachat password.
=head3 channels
This option can be specified multiple times, with values as strings. C<spread-revolutionary-date> will spread on every channel specified with this option. This option should be specified at least one time if L</test> option is not set. It is ignored ...
=head3 test_channels
This option can be specified multiple times, with values as strings. C<spread-revolutionary-date> will spread on every channel specified with this option. This option should be specified at least one time if L</test> option is set. It is ignored if L...
=head2 Freenode options
The first two options are credentials for C<spread-revolutionary-date> to spread on a Freenode account. See L<https://freenode.net/kb/answer/registration> to find out how to register an account on Freenode. They should be defined in the C<[freenode]>...
=head3 nickname
This option can only be specified once, with a value as string: your Freenode nickname.
=head3 password
This option can only be specified once, with a value as string: your Freenode password.
=head3 channels
bin/spread-revolutionary-date view on Meta::CPAN
=head3 --locale=<fr|en|it|es> | -l <fr|en|it|es>
Same as L</locale> configuration option above.
=head3 --test | --no | -n
Same as L</test> configuration option above.
=head2 Mastodon parameters
These parameters specify credentials for C<spread-revolutionary-date> to spread on a Mastodon account. You have to get them from your L<Mastodon instance API account|https://mstdn.fr/settings/applications> with C<write> scope. Note that Mastodon is a...
=head3 --mastodon_instance=<instance> | -mi <instance>
Same as L</instance> configuration option above.
=head3 --mastodon_client_id=<id> | -mci <id>
Same as L</client_id> configuration option above.
=head3 --mastodon_client_secret)<secret> | -mcs <secret>
Same as L</client_secret> configuration option above.
=head3 --mastodon_access_token=<token> | -mat <token>
Same as L</access_token> configuration option above.
=head2 Bluesky parameters
These parameters specify credentials for C<spread-revolutionary-date> to spread on a Bluesky account. You have to get them from your L<Bluesky account|https://bsky.app/>.
=head3 --bluesky_identifier=<identifier> | -bi <identifier>
Same as L</identifier> configuration option above.
=head3 --bluesky_password=<password> | -bp <password>
Same as L</password> configuration option above.
=head2 Twitter parameters
These parameters specify credentials for C<spread-revolutionary-date> to spread on a Twitter account. You have to get them from your L<Twitter API account|https://apps.twitter.com/> with C<write> access level.
=head3 --twitter_consumer_key=<key> | -tck <key>
Same as L</consumer_key> configuration option above.
=head3 --twitter_consumer_secret=<secret> | -tcs <secret>
Same as L</consumer_secret> configuration option above.
=head3 --twitter_access_token=<token> | -tat <token>
Same as L</access_token> configuration option above.
=head3 --twitter_access_token_secret=<token secret> | -tats <token secret>
Same as L</access_token_secret> configuration option above.
=head2 Liberachat parameters
The first two parameters are credentials for C<spread-revolutionary-date> to spread on a Liberachat account. See L<https://libera.chat/guides/registration> to find out how to register an account on Liberachat.
=head3 --liberachat_nickname=<nick> | -ln <nick>
Same as L</nickname> configuration option above.
=head3 --liberachat_password=<passwd> | -lp <passwd>
Same as L</password> configuration option above.
=head3 --liberachat_channels=<channel> | -lc <channel>
Same as L</channels> configuration option above.
=head3 --liberachat_test_channels=<channel> | -ltc <channel>
Same as L</test_channels> configuration option above.
=head2 Freenode parameters
The first two parameters are credentials for C<spread-revolutionary-date> to spread on a Freenode account. See L<https://freenode.net/kb/answer/registration> to find out how to register an account on Freenode.
=head3 --freenode_nickname=<nick> | -fn <nick>
Same as L</nickname> configuration option above.
=head3 --freenode_password=<passwd> | -fp <passwd>
Same as L</password> configuration option above.
=head3 --freenode_channels=<channel> | -fc <channel>
bin/spread-revolutionary-date view on Meta::CPAN
and, then choose the prompt to use at execution time, like:
$ spread-revolutionary-date --msgmaker=Gemini --gemini_process=FamousBirthday --locale=en
$ spread-revolutionary-date --msgmaker=Gemini --gemini_process=MacronJokeColuche
$ spread-revolutionary-date --msgmaker=Gemini --gemini_process=BlanquiRevival
$ spread-revolutionary-date --msgmaker=Gemini --gemini_process=MeteoParis
These examples show how you can tweak your message to be spread. Let's review all these options:
First, you have to define credentials to use the I<Gemini API>, by defining the L</api_key> option. For this you need to get a I<Gemini API key>, by following instructions on L<https://ai.google.dev/gemini-api/docs/api-key>.
Then for each prompt, you have to choose an identifier, which is one word in camel case, like C<FamousBirthday>, C<MacronJokeColuche>, C<BlanquiRevival> or C<MeteoParis>. This prompt identifier should be the value of the C<< --gemini_process <ThisPro...
All other options are relative to one particular prompt, and therefore prefixed with the corresponding identifier. Under the hood, these options are hashes keyed with prompt identifiers:
=over
=item L</prompt>
This is the option where you can define your prompt. It is advised to test this prompt to have I<Gemini> answer as you wish. For instance, I<Gemini> often start its answers to your prompt by: âSure, here is âwhat you've asked forâ, and you woul...
t/objects.t view on Meta::CPAN
isa_ok($spread_revolutionary_date->targets->{bluesky}->obj, 'App::SpreadRevolutionaryDate::BlueskyLite', 'Bluesky object');
isa_ok($spread_revolutionary_date->targets->{twitter}, 'App::SpreadRevolutionaryDate::Target::Twitter', 'Twitter class constructor');
isa_ok($spread_revolutionary_date->targets->{twitter}->obj, 'Twitter::API__WITH__Twitter::API::Trait::ApiMethods', 'Twitter object');
isa_ok($spread_revolutionary_date->targets->{mastodon}, 'App::SpreadRevolutionaryDate::Target::Mastodon', 'Mastodon class constructor');
isa_ok($spread_revolutionary_date->targets->{mastodon}->obj, 'Mastodon::Client', 'Mastodon object');
isa_ok($spread_revolutionary_date->targets->{freenode}, 'App::SpreadRevolutionaryDate::Target::Freenode', 'Freenode class constructor');
isa_ok($spread_revolutionary_date->targets->{freenode}->obj, 'App::SpreadRevolutionaryDate::Target::Freenode::Bot', 'Freenode object');
isa_ok($spread_revolutionary_date->targets->{liberachat}, 'App::SpreadRevolutionaryDate::Target::Liberachat', 'Liberachat class constructor');
isa_ok($spread_revolutionary_date->targets->{liberachat}->obj, 'App::SpreadRevolutionaryDate::Target::Liberachat::Bot', 'Liberachat object');
ok(!$spread_revolutionary_date->targets->{bluesky}->obj->{did}, 'Bluesky no connection with fake credentials');
eval { $spread_revolutionary_date->targets->{twitter}->obj->verify_credentials };
like($@, qr/^(?:Invalid or expired token|599 Internal Exception)/, 'Twitter no connection with fake credentials');
eval { $spread_revolutionary_date->targets->{mastodon}->obj->get_account };
like($@, qr/^Could not complete request: (?:500 Can't connect to Instance|599 Internal Exception|404 Not Found)/, 'Mastodon no connection with fake credentials');
__DATA__
test
[bluesky]
# Get these values from https://bsky.app/
identifier = 'Identifier'
password = 'Password'
xt/authentication.t view on Meta::CPAN
} else {
plan tests => 3;
}
use App::SpreadRevolutionaryDate;
@ARGV = ('--test', '--twitter_api=1', '--targets=mastodon', '--targets=bluesky', '--targets=twitter');
my $spread_revolutionary_date = App::SpreadRevolutionaryDate->new;
eval { $spread_revolutionary_date->targets->{mastodon}->obj->get_account };
ok(!$@, 'Mastodon connection with actual credentials in user conf');
ok($spread_revolutionary_date->targets->{bluesky}->obj->{did}, 'Bluesky connection with actual credentials in user conf');
eval { $spread_revolutionary_date->targets->{twitter}->obj->verify_credentials };
ok(!$@, 'Twitter connection with actual credentials in user conf');
( run in 0.260 second using v1.01-cache-2.11-cpan-a5abf4f5562 )