driver-slack icon indicating copy to clipboard operation
driver-slack copied to clipboard

Add support for reactions

Open iNilo opened this issue 5 years ago • 1 comments

I'd love to reply to a message / command, not by text, but by reaction.

I'm trying to look into this myself, but I'm not experienced enough yet

eg:

$botman->hears('wave', function (BotMan $bot)
{
       $bot->replyWithReaction("thumbsup");
});

https://api.slack.com/methods/reactions.add

I suppose it would need to be added here https://github.com/botman/driver-slack/blob/a832671a0bc2a42b083ebaea60ea7a4efee96045/src/SlackDriver.php#L258

iNilo avatar Nov 22 '20 14:11 iNilo

For those stumbling across this issue:

Currently I'm achieving this with a 2nd framework

https://github.com/jolicode/slack-php-api

$SlackClient = JoliCode\Slack\ClientFactory::create($SLACK_TOKEN);

$botman->hears('thumbsup', function (BotMan $bot)
{
	global $SlackClient;
	$SlackClient->reactionsAdd(
		[
			'channel' => $bot->getMessage()->getPayload()->get('channel'),
			'name' => 'thumbsup',
			'timestamp' => $bot->getMessage()->getPayload()->get('ts'),
		]);
});

iNilo avatar Nov 24 '20 10:11 iNilo