File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -79,4 +79,30 @@ responder reload_slack => {
7979 return $event -> reply_error(" Sorry, I didn't understand your reload command." );
8080};
8181
82+ command slacksnippet => {
83+ } => async sub ($self , $event , $text ) {
84+ my $channel = $event -> from_channel;
85+
86+ unless ($channel -> can(' slack' )) {
87+ return await $event -> error_reply(" Sorry, you can't use *slackid* outside Slack" );
88+ }
89+
90+ my $text = join q{ } , (" $text \n " ) x 25 ;
91+
92+ my $res = await $channel -> slack-> api_call(
93+ ' files.upload' ,
94+ {
95+ form_encoded => 1, # Sigh.
96+
97+ content => $text ,
98+ channels => $event -> conversation_address,
99+ initial_comment => " Here's what you said, as a snippet." ,
100+ },
101+ );
102+
103+ warn $res -> as_string;
104+
105+ return ;
106+ };
107+
821081;
You can’t perform that action at this time.
0 commit comments