]> git.donarmstrong.com Git - infobot.git/blobdiff - src/CLI/Support.pl
action
[infobot.git] / src / CLI / Support.pl
index 6b2de5b1e972dbdba5a92ce13620b7423f36e4a4..e61a1b367cb01ef1c8dad99c6c63dace390b47c7 100644 (file)
@@ -51,6 +51,22 @@ sub msg {
     print("$nick: $msg\n");
 }
 
+# Usage: &action(nick || chan, txt);
+sub action {
+    my ($target, $txt) = @_;
+    if (!defined $txt) {
+       &WARN("action: txt == NULL.");
+       return;
+    }
+
+    if (length $txt > 480) {
+       &status("action: txt too long; truncating.");
+       chop($txt) while (length $txt > 480);
+    }
+
+    &status("* $ident/$target $txt");
+}
+
 sub IsNickInChan {
     my ($nick,$chan) = @_;
     return 1;