aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2016-09-17 22:28:30 -0400
committerTeddy Wing2016-09-17 22:28:30 -0400
commite61989c9d9e251642dd361832181c4a9494aedae (patch)
tree2087d85bfd42b72a98880e8f3a9f67fa5f71aad2
parent03fd89f3d99249d9a53757d7e4d0283f7e5bf63a (diff)
downloadirssi-slack-profile-e61989c9d9e251642dd361832181c4a9494aedae.tar.bz2
help: Add built-in help for `slack_profile_sync` & `slack_profile_set`
-rw-r--r--slack_profile.pl51
1 files changed, 47 insertions, 4 deletions
diff --git a/slack_profile.pl b/slack_profile.pl
index cd34179..96aebfe 100644
--- a/slack_profile.pl
+++ b/slack_profile.pl
@@ -56,9 +56,14 @@ my @users_list;
sub help {
my ($args) = @_;
- return unless $args =~ /^swhois\s*$/;
- my $help = <<HELP;
+ my $is_helping = 0;
+ my $help = '';
+
+ if ($args =~ /^swhois\s*$/) {
+ $is_helping = 1;
+
+ $help = <<HELP;
%9Syntax:%9
SWHOIS [<nick>]
@@ -74,9 +79,47 @@ SWHOIS [<nick>]
/SWHOIS farnsworth
/SWHOIS \@farnsworth
HELP
+ }
+ elsif ($args =~ /^slack_profile_sync\s*$/) {
+ $is_helping = 1;
- Irssi::print($help, MSGLEVEL_CLIENTCRAP);
- Irssi::signal_stop();
+ $help = <<HELP;
+%9Syntax:%9
+
+SLACK_PROFILE_SYNC
+
+%9Description:%9
+
+ Re-fetches the users list from Slack and updates the script's internal
+ cache with this copy. %9Note: this will block Irssi and take a while.%9
+
+%9Examples:%9
+
+ /SLACK_PROFILE_SYNC
+HELP
+ }
+ elsif ($args =~ /^slack_profile_set\s*$/) {
+ $is_helping = 1;
+
+ $help = <<HELP;
+%9Syntax:%9
+
+SLACK_PROFILE_SET <key> <value>
+
+%9Description:%9
+
+ Update the given Slack profile field for the current nick.
+
+%9Examples:%9
+
+ /SLACK_PROFILE_SET first_name Lisa
+HELP
+ }
+
+ if ($is_helping) {
+ Irssi::print($help, MSGLEVEL_CLIENTCRAP);
+ Irssi::signal_stop();
+ }
}
sub users_list_cache {