Adam

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


0.90      2011-05-15 18:54:53 Europe/Berlin
	+ dzil'ed distribution (Getty)
	+ Plugins' USER events were not being registered correctly. Fixed. (Hinrik)

0.09 2011-05-15
	+ Fix a bug that involves the plugin method events() by making it private. (perigrin)
	+ Continue to not document it. (perigrin)

0.08 2010-06-17
	+ Fix a mistake we accidentally released in 0.07

0.07 2010-06-10
	+ Fix _build__irc to pull from the bot configuration (stephan48)
	+ Add RT Plugin example and netcat bot example

0.06  2009-10-30
	+ Moses::Declare
	  MooseX::Declare derived syntax for writing Bots, very experimental.
	+ Adam::Logger
	  Refactor of the logging API so that we can use alternate Logging

ex/ai-bot.pl  view on Meta::CPAN

      required => ['reason'],
    },
    code => sub {
      my ($tool, $args) = @_;
      return $tool->text_result('__SILENT__');
    },
  );

  $server->tool(
    name         => 'set_alarm',
    description  => 'Set an alarm that wakes you up after a delay in seconds. Like a timer or reminder — when it fires, you get woken up with the reason and can decide what to do: respond, call tools, or stay silent. You do NOT pre-write a message;...
    input_schema => {
      type       => 'object',
      properties => {
        reason => { type => 'string', description => 'Why you are setting this alarm — this will be shown to you when it fires' },
        delay_seconds => { type => 'number', description => 'How many seconds to wait (10-3600)' },
      },
      required => ['reason', 'delay_seconds'],
    },
    code => sub {
      my ($tool, $args) = @_;

ex/ai-bot.pl  view on Meta::CPAN

- Use send_private_message to reply privately.
- Good for sensitive info, personal conversations, or things not for the whole channel.

WHOIS:
- Use the whois tool to look up info about a user (real name, host, channels, idle).
- Results arrive asynchronously as a system message — you'll see them shortly after.
- Great for learning about new people or checking if someone's host changed.

ALARMS:
- Use set_alarm to wake yourself up after a delay in seconds (10-3600).
- When the alarm fires, you get a new message with your reason and can decide what to do.
- Useful for follow-ups, reminders, checking back on something, or timed actions.
- When you ask someone a question, set an alarm (120-300s) to follow up
  if they don't answer. But when the alarm fires, consider if they just moved on
  — sometimes staying silent is the right call even then.

IDLE PINGS:
- When nobody has talked for a while, you'll get a system message about it.
- Usually just stay_silent. Only speak if you have something genuinely worth saying.
- An empty channel doesn't need you to fill the silence.

ex/ai-bot.pl  view on Meta::CPAN

event _retry_raid => sub {
  my ($self) = $_[OBJECT];
  $self->info("Retrying raid...");
  $self->_do_raid;
};

event _alarm_fired => sub {
  my ( $self, $channel, $reason ) = @_[ OBJECT, ARG0, ARG1 ];
  $self->info("Alarm fired: $reason");
  $self->_buffer_message($channel, 'system',
    "ALARM FIRED: $reason — You set this alarm earlier. Decide what to do now.");
};

event _idle_check => sub {
  my ($self) = $_[OBJECT];
  my $idle_secs = time() - $self->_last_activity;
  if ($idle_secs >= $IDLE_PING && !$self->_processing) {
    my $idle_mins = int($idle_secs / 60);
    $self->info("Idle ping after ${idle_mins}m");
    # Ping first channel only (idle is a global concept)
    my $channel = $self->_default_channel;



( run in 0.966 second using v1.01-cache-2.11-cpan-99c4e6809bf )