diff --git a/lib/Synergy/Reactor/SlackID.pm b/lib/Synergy/Reactor/SlackID.pm index 12a972d6..941dd33e 100644 --- a/lib/Synergy/Reactor/SlackID.pm +++ b/lib/Synergy/Reactor/SlackID.pm @@ -79,4 +79,30 @@ responder reload_slack => { return $event->reply_error("Sorry, I didn't understand your reload command."); }; +command slacksnippet => { +} => async sub ($self, $event, $text) { + my $channel = $event->from_channel; + + unless ($channel->can('slack')) { + return await $event->error_reply("Sorry, you can't use *slackid* outside Slack"); + } + + my $text = join q{}, ("$text\n") x 25; + + my $res = await $channel->slack->api_call( + 'files.upload', + { + form_encoded => 1, # Sigh. + + content => $text, + channels => $event->conversation_address, + initial_comment => "Here's what you said, as a snippet.", + }, + ); + + warn $res->as_string; + + return; +}; + 1;