Skip to content

Commit 13dea13

Browse files
committed
SlackID: do not try to reload over not-slack
1 parent 4057f2b commit 13dea13

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/Synergy/Reactor/SlackID.pm

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,20 @@ responder reload_slack => {
5959
} => async sub ($self, $event, $what) {
6060
$event->mark_handled;
6161

62+
my $channel = $event->from_channel;
63+
64+
unless ($channel->can('slack')) {
65+
return await $event->error_reply("Sorry, you can't use *slackid* outside Slack");
66+
}
67+
6268
if ($what eq 'users') {
63-
$event->from_channel->slack->load_users;
64-
$event->from_channel->slack->load_dm_channels;
69+
$channel->slack->load_users;
70+
$channel->slack->load_dm_channels;
6571
return $event->reply('Slack users reloaded');
6672
}
6773

6874
if ($what eq 'channels') {
69-
$event->from_channel->slack->load_channels;
75+
$channel->slack->load_channels;
7076
return $event->reply('Slack channels reloaded');
7177
}
7278

0 commit comments

Comments
 (0)