The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

statsbot - simple IRC bot that tracks time spent in a channel

SYNOPSIS

  statsbot --nickname=sbot --channel='#somechan'
  # Bot will respond to queries of the forms:
  # < mgv> !presence mgv
  # < mgv>   presence mgv '1 day'
  # < mgv> BOTNICK: !presence mgv '1 year' 2
  # < mgv> BOTNICK,    presence   mgv
  # < mgv>   !help
  # < mgv> BOTNICK:    help
  # < mgv> BOTNICK,  help

DESCRIPTION

statsbot is a simple IRC bot that tracks the people that inhabit a channel. It is able to answer queries of the form "In the last <time interval>, how much time did <nick> spend in this channel?".

It responds to queries of the form presence NICK [TIME [PRECISION]], optionally preceded by BOTNICK: or BOTNICK,. There can also be an optional "!" sign before the word "presence".

where BOTNICK is the nickname of the bot, NICK is the nickname of a channel inhabitant, TIME is the interval that is considered, and PRECISION is the number of units to display. For example, if a PRECISION of 3 yields "1 hour, 2 minutes and 10 seconds", a PRECISION of 2 would yield "1 hour and 2 minutes" while a PRECISION of 1 would yield "1 hour".

By default, the interval that is considered is one day and the result is displayed in hours.

OPTIONS

--debug, --no-debug

If --debug, prints some debug information. Defaults to --no-debug.

--tick=60

How often (in seconds) to poll the channel for nicks. Defaults to 10 seconds.

--nickname="timebot"

The nickname of the bot. Defaults to "statsbot".

--server="irc.oftc.net"

The IRC server. Defaults to "irc.freenode.net".

--port=6697

The port. Defaults to 6667.

--ssl, --no-ssl.

If --ssl, connect via SSL. Defaults to --no-ssl.

--channel="#mychan"

The channel that should be monitored. Multiple channels can be monitored by repeating this option.

--db=/path/to/some/file.sqlite

Path to SQLite database. Must be writable. Will be created if it does not exist. Defaults to /var/lib/statsbot/db.

ENVIRONMENT

All options can be passed via the environment. If an option is passed both as an environment variable and as an argument, the argument takes priority.

STATSBOT_DEBUG=1

Equivalent to --debug.

STATSBOT_TICK=60

Equivalent to --tick=60.

STATSBOT_NICKNAME="timebot"

Equivalent to --nickname="timebot".

STATSBOT_SERVER="irc.oftc.net"

Equivalent to --server="irc.oftc.net".

STATSBOT_PORT=6697

Equivalent to --port=6697.

STATSBOT_SSL=1

Equivalent to --ssl.

STATSBOT_CHANNELS="#mychan #otherchan"

Equivalent to --channel=#mychan --channel=#otherchan.

STATSBOT_DB="/path/to/some/file.sqlite"

Equivalent to --db="/path/to/some/file.sqlite".

SEE ALSO

App::Statsbot

AUTHOR

Marius Gavrilescu, <marius@ieval.ro>

COPYRIGHT AND LICENSE

Copyright (C) 2013-2016 by Marius Gavrilescu

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.20.2 or, at your option, any later version of Perl 5 you may have available.