Skip to content

Commit

Permalink
upgrading vendor directory; releasing beta.5
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmcandrew committed Mar 18, 2020
1 parent cc40ad6 commit 1d60b10
Show file tree
Hide file tree
Showing 593 changed files with 24,068 additions and 31,184 deletions.
387 changes: 236 additions & 151 deletions composer.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<url desc="Support">https://thirdsectordesign.org/chatbot</url>
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2019-01-29</releaseDate>
<version>1.0.0-beta.4</version>
<releaseDate>2019-03-18</releaseDate>
<version>1.0.0-beta.5</version>
<develStage>beta</develStage>
<compatibility>
<ver>5.0</ver>
Expand Down
1 change: 1 addition & 0 deletions vendor/bin/var-dump-server
15 changes: 15 additions & 0 deletions vendor/botman/botman/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
[![Slack](https://rauchg-slackin-jtdkltstsj.now.sh/badge.svg)](https://rauchg-slackin-jtdkltstsj.now.sh)
[![Monthly Downloads](https://img.shields.io/packagist/dm/botman/botman.svg?style=flat-square)](https://packagist.org/packages/botman/botman)

[![https://phppackagedevelopment.com](https://display-demo.schlein.net/images/phppd.jpg)](https://phppackagedevelopment.com)

If you want to learn how to create reusable PHP packages yourself, take a look at my upcoming [PHP Package Development](https://phppackagedevelopment.com) video course.

## About BotMan

BotMan is a framework agnostic PHP library that is designed to simplify the task of developing innovative bots for multiple messaging platforms, including [Slack](https://slack.com), [Telegram](https://telegram.org), [Microsoft Bot Framework](https://dev.botframework.com), [Nexmo](https://www.nexmo.com), [HipChat](https://www.hipchat.com), [Facebook Messenger](https://www.messenger.com) and [WeChat](https://web.wechat.com).
Expand All @@ -20,6 +24,8 @@ $botman->hears('I want cross-platform bots with PHP!', function (BotMan $bot) {
});
```

> If you want to learn how to create reusable PHP packages yourself, take a look at my upcoming [PHP Package Development](https://phppackagedevelopment.com) video course.
## Documentation

You can find the BotMan documentation at [https://botman.io](https://botman.io).
Expand All @@ -35,6 +41,15 @@ You can find the BotMan documentation at [https://botman.io](https://botman.io).

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

[![0](https://sourcerer.io/fame/sergey48k/botman/botman/images/0)](https://sourcerer.io/fame/sergey48k/botman/botman/links/0)
[![1](https://sourcerer.io/fame/sergey48k/botman/botman/images/1)](https://sourcerer.io/fame/sergey48k/botman/botman/links/1)
[![2](https://sourcerer.io/fame/sergey48k/botman/botman/images/2)](https://sourcerer.io/fame/sergey48k/botman/botman/links/2)
[![3](https://sourcerer.io/fame/sergey48k/botman/botman/images/3)](https://sourcerer.io/fame/sergey48k/botman/botman/links/3)
[![4](https://sourcerer.io/fame/sergey48k/botman/botman/images/4)](https://sourcerer.io/fame/sergey48k/botman/botman/links/4)
[![5](https://sourcerer.io/fame/sergey48k/botman/botman/images/5)](https://sourcerer.io/fame/sergey48k/botman/botman/links/5)
[![6](https://sourcerer.io/fame/sergey48k/botman/botman/images/6)](https://sourcerer.io/fame/sergey48k/botman/botman/links/6)
[![7](https://sourcerer.io/fame/sergey48k/botman/botman/images/7)](https://sourcerer.io/fame/sergey48k/botman/botman/links/7)

## Security Vulnerabilities

If you discover a security vulnerability within BotMan, please send an e-mail to Marcel Pociot at [email protected]. All security vulnerabilities will be promptly addressed.
Expand Down
2 changes: 1 addition & 1 deletion vendor/botman/botman/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"tightenco/collect": "~5.0",
"opis/closure": "^2.3 || ^3.0",
"mpociot/pipeline": "^1.0",
"react/socket": "~0.4",
"react/socket": "~1.0",
"spatie/macroable": "^1.0",
"psr/container": "^1.0"
},
Expand Down
15 changes: 14 additions & 1 deletion vendor/botman/botman/src/BotMan.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use BotMan\BotMan\Traits\HandlesConversations;
use Symfony\Component\HttpFoundation\Response;
use BotMan\BotMan\Commands\ConversationManager;
use BotMan\BotMan\Messages\Attachments\Contact;
use BotMan\BotMan\Middleware\MiddlewareManager;
use BotMan\BotMan\Messages\Attachments\Location;
use BotMan\BotMan\Exceptions\Base\BotManException;
Expand Down Expand Up @@ -337,6 +338,18 @@ public function receivesLocation($callback)
return $this->hears(Location::PATTERN, $callback);
}

/**
* Listening for contact attachment.
*
* @param $callback
*
* @return Command
*/
public function receivesContact($callback)
{
return $this->hears(Contact::PATTERN, $callback);
}

/**
* Listening for files attachment.
*
Expand Down Expand Up @@ -687,7 +700,7 @@ protected function getCallable($callback)
$callback = $this->makeInvokableAction($callback);
}

list($class, $method) = explode('@', $callback);
[$class, $method] = explode('@', $callback);

$command = $this->container ? $this->container->get($class) : new $class($this);

Expand Down
3 changes: 3 additions & 0 deletions vendor/botman/botman/src/Commands/ConversationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use BotMan\BotMan\Messages\Attachments\Audio;
use BotMan\BotMan\Messages\Attachments\Image;
use BotMan\BotMan\Messages\Attachments\Video;
use BotMan\BotMan\Messages\Attachments\Contact;
use BotMan\BotMan\Middleware\MiddlewareManager;
use BotMan\BotMan\Messages\Attachments\Location;
use BotMan\BotMan\Messages\Incoming\IncomingMessage;
Expand Down Expand Up @@ -48,6 +49,8 @@ public function addDataParameters(IncomingMessage $message, array $parameters)
$parameters[] = $message->getAudio();
} elseif ($messageText === Location::PATTERN) {
$parameters[] = $message->getLocation();
} elseif ($messageText === Contact::PATTERN) {
$parameters[] = $message->getContact();
} elseif ($messageText === File::PATTERN) {
$parameters[] = $message->getFiles();
}
Expand Down
118 changes: 118 additions & 0 deletions vendor/botman/botman/src/Messages/Attachments/Contact.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?php

namespace BotMan\BotMan\Messages\Attachments;

class Contact extends Attachment
{
/**
* Pattern that messages use to identify contact attachment.
*/
const PATTERN = '%%%_CONTACT_%%%';

/** @var string */
protected $phone_number;

/** @var string */
protected $first_name;

/** @var string */
protected $last_name;

/** @var string */
protected $user_id;

/** @var string */
protected $vcard;

/**
* Message constructor.
*
* @param string $phone_number
* @param string $first_name
* @param string $last_name
* @param string $user_id
* @param string $vcard
* @param mixed $payload
*/
public function __construct($phone_number, $first_name, $last_name, $user_id, $vcard = null, $payload = null)
{
parent::__construct($payload);
$this->phone_number = $phone_number;
$this->first_name = $first_name;
$this->last_name = $last_name;
$this->user_id = $user_id;
$this->vcard = $vcard;
}

/**
* @param string $phone_number
* @param string $first_name
* @param string $last_name
* @param string $user_id
* @param string $vcard
*
* @return Contact
*/
public static function create($phone_number, $first_name, $last_name, $user_id, $vcard = null)
{
return new self($phone_number, $first_name, $last_name, $user_id, $vcard);
}

/**
* @return string
*/
public function getPhoneNumber()
{
return $this->phone_number;
}

/**
* @return string
*/
public function getFirstName()
{
return $this->first_name;
}

/**
* @return string
*/
public function getLastName()
{
return $this->last_name;
}

/**
* @return string
*/
public function getUserId()
{
return $this->user_id;
}

/**
* @return string
*/
public function getVcard()
{
return $this->vcard;
}

/**
* Get the instance as a web accessible array.
* This will be used within the WebDriver.
*
* @return array
*/
public function toWebDriver()
{
return [
'type' => 'contact',
'phone_number' => $this->phone_number,
'first_name' => $this->first_name,
'last_name' => $this->last_name,
'user_id' => $this->user_id,
'vcard' => $this->vcard,
];
}
}
34 changes: 34 additions & 0 deletions vendor/botman/botman/src/Messages/Conversations/Conversation.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use BotMan\BotMan\Messages\Attachments\Image;
use BotMan\BotMan\Messages\Attachments\Video;
use BotMan\BotMan\Messages\Outgoing\Question;
use BotMan\BotMan\Messages\Attachments\Contact;
use BotMan\BotMan\Messages\Attachments\Location;
use BotMan\BotMan\Messages\Incoming\IncomingMessage;

Expand Down Expand Up @@ -83,6 +84,22 @@ public function askForImages($question, $next, $repeat = null, $additionalParame
return $this->ask($question, $next, $additionalParameters);
}

/**
* @param string|\BotMan\BotMan\Messages\Outgoing\Question $question
* @param array|Closure $next
* @param array|Closure $repeat
* @param array $additionalParameters
* @return $this
*/
public function askForFiles($question, $next, $repeat = null, $additionalParameters = [])
{
$additionalParameters['__getter'] = 'getFiles';
$additionalParameters['__pattern'] = File::PATTERN;
$additionalParameters['__repeat'] = ! is_null($repeat) ? $this->bot->serializeClosure($repeat) : $repeat;

return $this->ask($question, $next, $additionalParameters);
}

/**
* @param string|\BotMan\BotMan\Messages\Outgoing\Question $question
* @param array|Closure $next
Expand Down Expand Up @@ -131,6 +148,23 @@ public function askForLocation($question, $next, $repeat = null, $additionalPara
return $this->ask($question, $next, $additionalParameters);
}

/**
* @param string|\BotMan\BotMan\Messages\Outgoing\Question $question
* @param array|Closure $next
* @param array|Closure $repeat
* @param array $additionalParameters
*
* @return $this
*/
public function askForContact($question, $next, $repeat = null, $additionalParameters = [])
{
$additionalParameters['__getter'] = 'getContact';
$additionalParameters['__pattern'] = Contact::PATTERN;
$additionalParameters['__repeat'] = ! is_null($repeat) ? $this->bot->serializeClosure($repeat) : $repeat;

return $this->ask($question, $next, $additionalParameters);
}

/**
* Repeat the previously asked question.
* @param string|Question $question
Expand Down
24 changes: 24 additions & 0 deletions vendor/botman/botman/src/Messages/Incoming/IncomingMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace BotMan\BotMan\Messages\Incoming;

use Illuminate\Support\Collection;
use BotMan\BotMan\Messages\Attachments\Contact;
use BotMan\BotMan\Messages\Attachments\Location;

class IncomingMessage
Expand Down Expand Up @@ -37,6 +38,9 @@ class IncomingMessage
/** @var \BotMan\BotMan\Messages\Attachments\Location */
private $location;

/** @var \BotMan\BotMan\Messages\Attachments\Contact */
private $contact;

/** @var bool */
protected $isFromBot = false;

Expand Down Expand Up @@ -210,6 +214,26 @@ public function getLocation() : Location
return $this->location;
}

/**
* @return \BotMan\BotMan\Messages\Attachments\Contact
*/
public function getContact() : Contact
{
if (empty($this->contact)) {
throw new \UnexpectedValueException('This message does not contain a contact');
}

return $this->contact;
}

/**
* @param \BotMan\BotMan\Messages\Attachments\Contact $contact
*/
public function setContact(Contact $contact)
{
$this->contact = $contact;
}

/**
* @return bool
*/
Expand Down
11 changes: 11 additions & 0 deletions vendor/botman/botman/src/Middleware/ApiAi.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,23 @@ public function received(IncomingMessage $message, $next, BotMan $bot)
$actionIncomplete = isset($response->result->actionIncomplete) ? (bool) $response->result->actionIncomplete : false;
$intent = $response->result->metadata->intentName ?? '';
$parameters = isset($response->result->parameters) ? (array) $response->result->parameters : [];
$responseMessages = isset($response->result->fulfillment->messages) ? json_decode(json_encode($response->result->fulfillment->messages), true) : [];
$contexts = isset($response->result->contexts) ? json_decode(json_encode($response->result->contexts), true) : [];

if (count($responseMessages)) {
$textResponses = count(collect($responseMessages)->where('type', 0)) ? array_values(collect($responseMessages)->where('type', 0)->toArray()) : [];
$customPayloadResponses = count(collect($responseMessages)->where('type', 4)) ? array_values(collect($responseMessages)->where('type', 4)->toArray()) : [];
}

$message->addExtras('apiReply', $reply);
$message->addExtras('apiAction', $action);
$message->addExtras('apiActionIncomplete', $actionIncomplete);
$message->addExtras('apiIntent', $intent);
$message->addExtras('apiParameters', $parameters);
$message->addExtras('apiResponseMessages', $responseMessages);
$message->addExtras('apiTextResponses', $textResponses ?? []);
$message->addExtras('apiCustomPayloadResponses', $customPayloadResponses ?? []);
$message->addExtras('apiContexts', $contexts);

return $next($message);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace BotMan\Drivers\Facebook\Events;

class MessagingAccountLinking extends FacebookEvent
{
/**
* Return the event name to match.
*
* @return string
*/
public function getName()
{
return 'messaging_account_linking';
}
}
Loading

0 comments on commit 1d60b10

Please sign in to comment.