diff --git a/src/Http/Controllers/EventsController.php b/src/Http/Controllers/EventsController.php index 1718f8f..40d8c83 100644 --- a/src/Http/Controllers/EventsController.php +++ b/src/Http/Controllers/EventsController.php @@ -9,7 +9,7 @@ use App\Http\Controllers\Controller; use Slack\Client\Payload; use Slack\Event\Factory as SlackEventFactory; -class EventsController extends Controller +final class EventsController extends Controller { private const LOGKEY = 'CEC'; diff --git a/src/Http/Controllers/InteractiveMessageController.php b/src/Http/Controllers/InteractiveMessageController.php index 35b2836..4f31896 100644 --- a/src/Http/Controllers/InteractiveMessageController.php +++ b/src/Http/Controllers/InteractiveMessageController.php @@ -10,7 +10,7 @@ use Slack\Client\Payload; use Slack\Message; use Slack\Interactive\Factory as InteractiveMessageFactory; -class InteractiveMessageController extends Controller +final class InteractiveMessageController extends Controller { private const LOGKEY = 'CIM'; diff --git a/src/Http/Controllers/InteractiveOptionsController.php b/src/Http/Controllers/InteractiveOptionsController.php index 111787d..ded5845 100644 --- a/src/Http/Controllers/InteractiveOptionsController.php +++ b/src/Http/Controllers/InteractiveOptionsController.php @@ -9,7 +9,7 @@ use App\Http\Controllers\Controller; use Slack\Client\Payload; use Slack\Options\Factory as SlackOptionsFactory; -class InteractiveOptionsController extends Controller +final class InteractiveOptionsController extends Controller { private const LOGKEY = 'CIO'; diff --git a/src/Http/Controllers/SlashCommandController.php b/src/Http/Controllers/SlashCommandController.php index 86d1981..5e2f6a2 100644 --- a/src/Http/Controllers/SlashCommandController.php +++ b/src/Http/Controllers/SlashCommandController.php @@ -12,7 +12,7 @@ use Slack\Command\Factory; use Slack\Message; use Slack\Message\Attachment; -class SlashCommandController extends Controller +final class SlashCommandController extends Controller { private const LOGKEY = 'CSC'; diff --git a/src/Http/Middleware/CheckRequest.php b/src/Http/Middleware/CheckRequest.php index b46dd19..9fe23fa 100644 --- a/src/Http/Middleware/CheckRequest.php +++ b/src/Http/Middleware/CheckRequest.php @@ -11,7 +11,7 @@ use Slack\Event\Factory as EventFactory; use Slack\Interactive\Factory as InteractiveFactory; use Slack\Options\Factory as OptionsFactory; -class CheckRequest +final class CheckRequest { private const LOGKEY = 'MCR'; diff --git a/src/Http/Middleware/CheckSignature.php b/src/Http/Middleware/CheckSignature.php index 7607c68..23f9667 100644 --- a/src/Http/Middleware/CheckSignature.php +++ b/src/Http/Middleware/CheckSignature.php @@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Log; use Slack\Base; -class CheckSignature +final class CheckSignature { private const LOGKEY = 'MCS'; @@ -67,4 +67,4 @@ class CheckSignature return $next($request); } -} +} \ No newline at end of file diff --git a/src/Interactive/BlockActions.php b/src/Interactive/BlockActions.php index ec17b2c..aa25961 100644 --- a/src/Interactive/BlockActions.php +++ b/src/Interactive/BlockActions.php @@ -55,7 +55,7 @@ use Slack\Models\Channel; * ) * ) */ -class BlockActions extends Base +final class BlockActions extends Base { private const LOGKEY = 'IBA'; diff --git a/src/Interactive/Factory.php b/src/Interactive/Factory.php index ed51f61..094c283 100644 --- a/src/Interactive/Factory.php +++ b/src/Interactive/Factory.php @@ -2,24 +2,24 @@ namespace Slack\Interactive; -use Illuminate\Http\Request; use Illuminate\Support\Arr; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Log; + use Slack\Client\Payload; class Factory { - private const LOGKEY = 'SIF'; + protected const LOGKEY = 'SIF'; /** * @var array event type to event class mapping */ public const map = [ 'block_actions' => BlockActions::class, - //'interactive_message' => InteractiveMessage::class, + 'interactive_message' => InteractiveMessage::class, 'shortcut' => Shortcut::class, 'view_closed' => ViewClosed::class, - //'view_submission' => ViewSubmission::class, + 'view_submission' => ViewSubmission::class, ]; /** diff --git a/src/Interactive/Unknown.php b/src/Interactive/Unknown.php index 4c2ad54..510b7c8 100644 --- a/src/Interactive/Unknown.php +++ b/src/Interactive/Unknown.php @@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Log; * * @package Slack\Interactive */ -class Unknown extends Base +final class Unknown extends Base { public function __construct(array $request) { diff --git a/src/Interactive/ViewClosed.php b/src/Interactive/ViewClosed.php index fdbb0d3..fbcdac3 100644 --- a/src/Interactive/ViewClosed.php +++ b/src/Interactive/ViewClosed.php @@ -65,7 +65,7 @@ use Illuminate\Support\Arr; */ class ViewClosed extends Base { - private const LOGKEY = 'IVC'; + protected const LOGKEY = 'IVC'; public function __get($key) { diff --git a/src/Jobs/DeleteChat.php b/src/Jobs/DeleteChat.php index 83278bb..46d277f 100644 --- a/src/Jobs/DeleteChat.php +++ b/src/Jobs/DeleteChat.php @@ -8,7 +8,7 @@ use Illuminate\Support\Facades\Log; use Slack\Models\{Channel,User}; use Slack\Exceptions\SlackException; -class DeleteChat extends Job +final class DeleteChat extends Job { private const LOGKEY = 'JDC'; diff --git a/src/Jobs/TeamUpdate.php b/src/Jobs/TeamUpdate.php index 549cc9b..a057e49 100644 --- a/src/Jobs/TeamUpdate.php +++ b/src/Jobs/TeamUpdate.php @@ -9,7 +9,7 @@ use Slack\Models\Team; class TeamUpdate extends Job { - private const LOGKEY = 'JTU'; + protected const LOGKEY = 'JTU'; /** * Create a new job instance. diff --git a/src/Listeners/AppHomeOpenedListener.php b/src/Listeners/AppHomeOpenedListener.php index a7a76c9..179dd84 100644 --- a/src/Listeners/AppHomeOpenedListener.php +++ b/src/Listeners/AppHomeOpenedListener.php @@ -12,7 +12,7 @@ class AppHomeOpenedListener implements ShouldQueue { protected const LOGKEY = 'LAH'; - public $queue = 'high'; + public $queue = 'slack'; /** * Handle the event. diff --git a/src/Listeners/BlockActionListener.php b/src/Listeners/BlockActionListener.php index 93141d2..5b8be49 100644 --- a/src/Listeners/BlockActionListener.php +++ b/src/Listeners/BlockActionListener.php @@ -12,7 +12,7 @@ use Slack\Interactive\BlockActions; * It's expected that the local application would implement this class completely, rather than using this * modules implementation. */ -abstract class BlockActionListener +class BlockActionListener { protected const LOGKEY = 'LBA'; diff --git a/src/Listeners/ChannelJoinListener.php b/src/Listeners/ChannelJoinListener.php index 2ab1997..b7519a0 100644 --- a/src/Listeners/ChannelJoinListener.php +++ b/src/Listeners/ChannelJoinListener.php @@ -11,7 +11,7 @@ class ChannelJoinListener implements ShouldQueue { protected const LOGKEY = 'LCJ'; - public $queue = 'high'; + public $queue = 'slack'; /** * Handle the event. diff --git a/src/Listeners/ChannelLeftListener.php b/src/Listeners/ChannelLeftListener.php index 4bbee4d..3e3a11c 100644 --- a/src/Listeners/ChannelLeftListener.php +++ b/src/Listeners/ChannelLeftListener.php @@ -11,7 +11,7 @@ class ChannelLeftListener implements ShouldQueue { protected const LOGKEY = 'LCL'; - public $queue = 'high'; + public $queue = 'slack'; /** * Handle the event. diff --git a/src/Listeners/InteractiveMessageListener.php b/src/Listeners/InteractiveMessageListener.php index a91b288..0732788 100644 --- a/src/Listeners/InteractiveMessageListener.php +++ b/src/Listeners/InteractiveMessageListener.php @@ -11,7 +11,7 @@ class InteractiveMessageListener implements ShouldQueue { protected const LOGKEY = 'LIM'; - public $queue = 'high'; + public $queue = 'slack'; /** * Handle the event. diff --git a/src/Listeners/MessageListener.php b/src/Listeners/MessageListener.php index 12eca8d..b3e0d13 100644 --- a/src/Listeners/MessageListener.php +++ b/src/Listeners/MessageListener.php @@ -11,7 +11,7 @@ class MessageListener implements ShouldQueue { protected const LOGKEY = 'LM-'; - public $queue = 'high'; + public $queue = 'slack'; /** * Handle the event. diff --git a/src/Listeners/PinAddedListener.php b/src/Listeners/PinAddedListener.php index ed0b132..401a343 100644 --- a/src/Listeners/PinAddedListener.php +++ b/src/Listeners/PinAddedListener.php @@ -11,7 +11,7 @@ class PinAddedListener implements ShouldQueue { protected const LOGKEY = 'LPA'; - public $queue = 'high'; + public $queue = 'slack'; /** * Handle the event. diff --git a/src/Listeners/PinRemovedListener.php b/src/Listeners/PinRemovedListener.php index 1b2fb2d..7c12227 100644 --- a/src/Listeners/PinRemovedListener.php +++ b/src/Listeners/PinRemovedListener.php @@ -11,7 +11,7 @@ class PinRemovedListener implements ShouldQueue { protected const LOGKEY = 'LPR'; - public $queue = 'high'; + public $queue = 'slack'; /** * Handle the event. diff --git a/src/Listeners/ReactionAddedListener.php b/src/Listeners/ReactionAddedListener.php index 6afe82a..d7a0f1e 100644 --- a/src/Listeners/ReactionAddedListener.php +++ b/src/Listeners/ReactionAddedListener.php @@ -11,7 +11,7 @@ class ReactionAddedListener implements ShouldQueue { protected const LOGKEY = 'LRA'; - public $queue = 'high'; + public $queue = 'slack'; /** * Handle the event. diff --git a/src/Listeners/ShortcutListener.php b/src/Listeners/ShortcutListener.php index d370353..9bc844c 100644 --- a/src/Listeners/ShortcutListener.php +++ b/src/Listeners/ShortcutListener.php @@ -14,8 +14,7 @@ class ShortcutListener //implements ShouldQueue { protected const LOGKEY = 'LSC'; - // Block actions arent queued, since slack expects a response to the request - //public $queue = 'high'; + public $queue = 'slack'; /** * Handle the event. diff --git a/src/Listeners/ViewClosedListener.php b/src/Listeners/ViewClosedListener.php index d085668..1d84b8c 100644 --- a/src/Listeners/ViewClosedListener.php +++ b/src/Listeners/ViewClosedListener.php @@ -11,7 +11,7 @@ class ViewClosedListener implements ShouldQueue { protected const LOGKEY = 'LVC'; - public $queue = 'high'; + public $queue = 'slack'; /** * Handle the event. diff --git a/src/Listeners/ViewSubmissionListener.php b/src/Listeners/ViewSubmissionListener.php index 6277335..8c2f4e2 100644 --- a/src/Listeners/ViewSubmissionListener.php +++ b/src/Listeners/ViewSubmissionListener.php @@ -11,7 +11,7 @@ class ViewSubmissionListener implements ShouldQueue { protected const LOGKEY = 'LVC'; - public $queue = 'high'; + public $queue = 'slack'; /** * Handle the event. diff --git a/src/Message.php b/src/Message.php index 6534486..f910215 100644 --- a/src/Message.php +++ b/src/Message.php @@ -23,7 +23,7 @@ use Slack\Response\Generic; */ final class Message extends BlockKit { - protected const LOGKEY = 'SM-'; + private const LOGKEY = 'SM-'; private const MAX_ATTACHMENTS = 20; diff --git a/src/Options/BlockSuggestion.php b/src/Options/BlockSuggestion.php new file mode 100644 index 0000000..5892c0a --- /dev/null +++ b/src/Options/BlockSuggestion.php @@ -0,0 +1,147 @@ + block_suggestion + [user] => stdClass Object + ( + [id] => U01QF1B0Y6B + [username] => deon + [name] => deon + [team_id] => T01QF14NSQP + ) + + [container] => stdClass Object + ( + [type] => view + [view_id] => V034715K8GP + ) + + [api_app_id] => A4TCZ007N + [token] => Oow8S2EFvrZoS9z8N4nwf9Jo + [action_id] => system_include_brand + [block_id] => YME + [value] => abcdde + [team] => stdClass Object + ( + [id] => T01QF14NSQP + [domain] => els953a-1 + [enterprise_id] => E01R1P48JCU + [enterprise_name] => Leenooks Enteprise A + ) + + [enterprise] => stdClass Object + ( + [id] => E01R1P48JCU + [name] => Leenooks Enteprise A + ) + + [is_enterprise_install] => + [view] => stdClass Object + ( + [id] => V034715K8GP + [team_id] => T01QF14NSQP + [type] => modal + [blocks] => Array + ( + [0] => stdClass Object + ( + [type] => section + [block_id] => YME + [text] => stdClass Object + ( + [type] => mrkdwn + [text] => Select Brands: + [verbatim] => + ) + + [accessory] => stdClass Object + ( + [type] => multi_external_select + [action_id] => system_include_brand + [initial_options] => Array + ( + ) + + [placeholder] => stdClass Object + ( + [type] => plain_text + [text] => select... + [emoji] => 1 + ) + + ) + + ) + + ) + + [private_metadata] => + [callback_id] => + [state] => stdClass Object + ( + [values] => stdClass Object + ( + [YME] => stdClass Object + ( + [system_include_brand] => stdClass Object + ( + [type] => multi_external_select + [selected_options] => Array + ( + ) + + ) + + ) + + ) + + ) + + [hash] => 1645768594.IO10vEq1 + [title] => stdClass Object + ( + [type] => plain_text + [text] => Configure brands + [emoji] => 1 + ) + + [clear_on_close] => + [notify_on_close] => + [close] => + [submit] => + [previous_view_id] => + [root_view_id] => V034715K8GP + [app_id] => A4TCZ007N + [external_id] => + [app_installed_team_id] => T01QF14NSQP + [bot_id] => B01RKPRAT0Q + ) +) +*/ +class BlockSuggestion extends Base +{ + protected const LOGKEY = 'OIM'; + + public function __get($key) + { + switch ($key) { + case 'action_id': + case 'value': + return object_get($this->_data,$key); + + case 'callback_id': + return object_get($this->_data,'view.'.$key); + + default: + return parent::__get($key); + } + } +} \ No newline at end of file diff --git a/src/Options/Factory.php b/src/Options/Factory.php index 7059bcb..9a7df23 100644 --- a/src/Options/Factory.php +++ b/src/Options/Factory.php @@ -6,24 +6,25 @@ use Illuminate\Http\Request; use Illuminate\Support\Arr; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Log; + use Slack\Client\Payload; -use Slack\Interactive\Unknown; class Factory { - private const LOGKEY = 'SOf'; + protected const LOGKEY = 'SOf'; /** * @var array event type to event class mapping */ public const map = [ - //'interactive_message' => InteractiveMessage::class, + 'block_suggestion' => BlockSuggestion::class, + 'interactive_message' => InteractiveMessage::class, ]; /** * Returns new event instance * - * @param string $type - * @param Request $request + * @param string $type + * @param array $request * @return Base */ public static function create(string $type,array $request) @@ -50,4 +51,4 @@ class Factory { return $o; } -} +} \ No newline at end of file diff --git a/src/Options/Unknown.php b/src/Options/Unknown.php index d83aa7c..ad732fa 100644 --- a/src/Options/Unknown.php +++ b/src/Options/Unknown.php @@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Log; * * @package Slack\Options */ -class Unknown extends Base +final class Unknown extends Base { public function __construct(array $request) { diff --git a/src/Providers/SlackServiceProvider.php b/src/Providers/SlackServiceProvider.php index 9b1a63c..fa7a8d3 100644 --- a/src/Providers/SlackServiceProvider.php +++ b/src/Providers/SlackServiceProvider.php @@ -10,9 +10,6 @@ use Slack\API; use Slack\Channels\SlackBotChannel; use Slack\Console\Commands\SlackSocketClient; -/** - * @todo For Lumen installs, this service provider is not required? - */ class SlackServiceProvider extends ServiceProvider { /** diff --git a/src/Response/Base.php b/src/Response/Base.php index 5372ad6..8e5e054 100644 --- a/src/Response/Base.php +++ b/src/Response/Base.php @@ -12,9 +12,9 @@ use Slack\Base as SlackBase; * * @note: This class is used for events not specifically created. */ -class Base extends SlackBase implements \JsonSerializable +abstract class Base extends SlackBase implements \JsonSerializable { - protected const LOGKEY = 'RB-'; + private const LOGKEY = 'RB-'; /** * Default Constructor Setup diff --git a/src/Response/ChannelList.php b/src/Response/ChannelList.php index 61944d9..6eb8aa5 100644 --- a/src/Response/ChannelList.php +++ b/src/Response/ChannelList.php @@ -4,7 +4,7 @@ namespace Slack\Response; final class ChannelList extends Base { - protected const LOGKEY = 'RCL'; + private const LOGKEY = 'RCL'; /** * Enable getting values for keys in the response diff --git a/src/Response/Chat.php b/src/Response/Chat.php index d5b69d6..e324452 100644 --- a/src/Response/Chat.php +++ b/src/Response/Chat.php @@ -8,9 +8,9 @@ use Illuminate\Support\Collection; /** * This is a Slack Response from a GetHistory API call which is a message Chat */ -class Chat extends Base +final class Chat extends Base { - protected const LOGKEY = 'RC-'; + private const LOGKEY = 'RC-'; /** * Enable getting values for keys in the response diff --git a/src/Response/Generic.php b/src/Response/Generic.php index be889f9..b807f74 100644 --- a/src/Response/Generic.php +++ b/src/Response/Generic.php @@ -5,9 +5,9 @@ namespace Slack\Response; /** * This is a Generic Slack Response to API calls */ -class Generic extends Base +final class Generic extends Base { - protected const LOGKEY = 'RGE'; + private const LOGKEY = 'RGE'; /** * Enable getting values for keys in the response diff --git a/src/Response/Team.php b/src/Response/Team.php index 6f181ab..f66ec27 100644 --- a/src/Response/Team.php +++ b/src/Response/Team.php @@ -9,7 +9,7 @@ namespace Slack\Response; */ final class Team extends Base { - protected const LOGKEY = 'RT_'; + private const LOGKEY = 'RT_'; /** * Enable getting values for keys in the response diff --git a/src/Response/Test.php b/src/Response/Test.php index 1dafecd..9e3a50c 100644 --- a/src/Response/Test.php +++ b/src/Response/Test.php @@ -5,9 +5,9 @@ namespace Slack\Response; /** * This is the Slack Response to an Auth Test API call */ -class Test extends Base +final class Test extends Base { - protected const LOGKEY = 'RTE'; + private const LOGKEY = 'RTE'; /** * Enable getting values for keys in the response diff --git a/src/Response/User.php b/src/Response/User.php index 3c38afa..56ea10d 100644 --- a/src/Response/User.php +++ b/src/Response/User.php @@ -9,7 +9,7 @@ namespace Slack\Response; */ final class User extends Base { - protected const LOGKEY = 'RU_'; + private const LOGKEY = 'RU_'; /** * Enable getting values for keys in the response