diff options
Diffstat (limited to 'tgrecv')
-rwxr-xr-x | tgrecv | 74 |
1 files changed, 55 insertions, 19 deletions
@@ -67,7 +67,6 @@ $cache->offset($updates->[-1]{'update_id'}+1) if ($AUTO_OFFSET && @$updates); print $out encode_json($updates); - __END__ =head1 NAME @@ -76,28 +75,54 @@ tgrecv - Receive updates from Telegram, output them as JSON =head1 SYNOPSIS -tgrecv [-h | --help] [-v] +B<tgrecv> [B<-h> | B<--help>] [B<-v>] -tgrecv [options] +B<tgrecv> [I<options>] =head1 OPTIONS - --offset Offset of the first message to receive - previous ones are - discarded - --auto-offset Use offset cache to automatically discard previous updates - (if combined with --offset, cache the last update but - still use the provided offset for the current request) - --timeout Timeout for long polling (default: 60 seconds) - --output=file Write the output to file instead of stdout - (--token | -t) <token> Bot token (see AUTHENTICATION) - --version Show version - --verbose | -v Show more information (combine with -h to see full manual) - --help | -h Show this message +=over + +=item B<--offset> + +Offset of the first message to receive - previous ones are discarded + +=item B<--auto-offset> + +Use offset cache to automatically discard previous updates (if combined with +B<--offset>, cache the last update but still use the provided offset for the +current request) + +=item B<--timeout=>I<seconds> + +Timeout for long polling (default: 60 seconds) + +=item B<--output=>I<file> + +Write the output to I<file> instead of stdout + +=item B<--token>=I<token>, B<-t> I<token> + +Bot token (see B<AUTHENTICATION>) + +=item B<--version> + +Show version + +=item B<--verbose>, B<-v> + +Show more information (combine with B<-h> to see full manual) + +=item B<--help>, B<-h> + +Show this message + +=back =head1 DESCRIPTION This program receives a single update batch from the Telegram bot identified by -B<token>, and outputs it as a JSON array. The array can contain multiple +I<token>, and outputs it as a JSON array. The array can contain multiple updates. The connection is blocking (long polling), so it waits until an update is available before exiting. @@ -105,9 +130,20 @@ is available before exiting. To get the bot token, this program will check (in order): - - The "--token" CLI argument - - The "TGUTILS_TOKEN" environment variable - - The contents of "$XDG_CONFIG_HOME/tgutils_token" - (usually ~/.config/tgutils_token) +=over 2 + +=item - + +The B<--token> CLI argument + +=item - + +The B<TGUTILS_TOKEN> environment variable + +=item - + +The contents of I<$XDG_CONFIG_HOME>B</tgutils_token> (usually B<~/.config/tgutils_token>) + +=back =cut |