aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2016-09-12 05:10:40 -0400
committerTeddy Wing2016-09-12 05:10:40 -0400
commit9bfac152d37c151dc3c3bce9aa6facc18a0c731a (patch)
treebb706fd8f3c8cbae8a517fdd775a0da1cdad3b12
parent34cd3cdaccbfe3408e83b9063490843569b9c4eb (diff)
downloadirssi-slack-profile-9bfac152d37c151dc3c3bce9aa6facc18a0c731a.tar.bz2
Add help for `/swhois`
Include a help document that can be accessed from inside Irssi showing a description of the `swhois` command and some examples. Leaned how to do this and format the output from: - https://github.com/irssi/scripts.irssi.org/blob/master/scripts/trackbar.pl - https://github.com/irssi/scripts.irssi.org/blob/22060fc4669627a9859c92efa2d6651e3673d494/scripts/spotify.pl - https://github.com/irssi/irssi/blob/b1ffd5f6472584aa3966746da9728c5afefcc4ce/docs/help/in/rehash.in - https://github.com/irssi/scripts.irssi.org/blob/22060fc4669627a9859c92efa2d6651e3673d494/scripts/clearable.pl
-rw-r--r--slack_profile.pl27
1 files changed, 27 insertions, 0 deletions
diff --git a/slack_profile.pl b/slack_profile.pl
index 20a102d..86038ce 100644
--- a/slack_profile.pl
+++ b/slack_profile.pl
@@ -54,6 +54,32 @@ $VERSION = '1.00';
my @users_list;
+sub help {
+ my ($args) = @_;
+
+ if ($args =~ /^swhois\s*$/) {
+ my $help = <<HELP;
+%9Syntax:%9
+
+SWHOIS [<nick>]
+
+%9Description:%9
+
+ Displays WHOIS-style profile information from Slack for the given nick. If
+ no nick argument is provided, the current nick is used.
+
+%9Examples:%9
+
+ /SWHOIS
+ /SWHOIS farnsworth
+ /SWHOIS \@farnsworth
+HELP
+
+ Irssi::print($help, MSGLEVEL_CLIENTCRAP);
+ Irssi::signal_stop();
+ }
+}
+
sub users_list_cache {
Irssi::get_irssi_dir() . '/scripts/users.list.plstore';
}
@@ -164,5 +190,6 @@ sub swhois {
}
Irssi::command_bind('swhois', 'swhois');
+Irssi::command_bind('help', 'help');
Irssi::settings_add_str('slack_profile', 'slack_profile_token', '');