From fb1a39d5c7bf923452248b85de6349a1c4e516fc Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 12 Sep 2016 20:32:48 -0400 Subject: Add command to refresh users list New command `/slack_profile sync` (and `/slack_profile` for now) re-fetches the users list from the Slack API. This gives users a way to update their cache manually in case they find that the information is out of date. --- slack_profile.pl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/slack_profile.pl b/slack_profile.pl index 91a4c7a..706da77 100644 --- a/slack_profile.pl +++ b/slack_profile.pl @@ -129,6 +129,12 @@ sub fetch_users_list { store \@users_list, users_list_cache; } +# Re-fetch the users list for the most up-to-date information +sub sync { + fetch_users_list(); + Irssi::print('Done.'); +} + sub fetch_user_profile { my ($user) = @_; @@ -232,6 +238,11 @@ sub swhois { } Irssi::command_bind('swhois', 'swhois'); + +Irssi::command_bind('slack_profile', 'sync'); +Irssi::command_bind('slack_profile sync', 'sync'); + Irssi::command_bind('help', 'help'); + Irssi::settings_add_str('slack_profile', 'slack_profile_token', ''); -- cgit v1.2.3