Skip to content

Commit

Permalink
SlackID: do not try to reload over not-slack
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Oct 25, 2023
1 parent 4057f2b commit 13dea13
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/Synergy/Reactor/SlackID.pm
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,20 @@ responder reload_slack => {
} => async sub ($self, $event, $what) {
$event->mark_handled;

my $channel = $event->from_channel;

unless ($channel->can('slack')) {
return await $event->error_reply("Sorry, you can't use *slackid* outside Slack");
}

if ($what eq 'users') {
$event->from_channel->slack->load_users;
$event->from_channel->slack->load_dm_channels;
$channel->slack->load_users;
$channel->slack->load_dm_channels;
return $event->reply('Slack users reloaded');
}

if ($what eq 'channels') {
$event->from_channel->slack->load_channels;
$channel->slack->load_channels;
return $event->reply('Slack channels reloaded');
}

Expand Down

0 comments on commit 13dea13

Please sign in to comment.