diff options
-rwxr-xr-x | smsbot | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -31,7 +31,9 @@ my ($opt, $usage) = describe_options( [ 'help', "print usage message and exit"], ); -print($usage->text), exit if $opt->help; +print($usage->text), exit if ($opt->help or @ARGV < 3); + +my ($jid, $pw, $inputfile, $room) = @ARGV; # TODO: support overriding full URL # TODO: use URI module to construct URL @@ -60,13 +62,6 @@ sub answer_to { binmode STDOUT, ":utf8"; -my ($jid, $pw, $inputfile, $room) = @ARGV; - -unless (@ARGV >= 3) { - warn "usage: talkbot <jid> <password> <talkfile> [<conference room jid>]\n"; - exit; -} - read_messages ($inputfile); my $j = AnyEvent->condvar; |