This repository has been archived by the owner on Nov 8, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Muraveiko
committed
Apr 10, 2020
1 parent
147b133
commit 3a15038
Showing
29 changed files
with
613 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
require_once "../vendor/autoload.php"; | ||
require_once "config.php"; | ||
|
||
use Antson\IcqBot\Entities\IcqEvent; | ||
use Antson\IcqBot\Entities\PayloadMessage; | ||
use Antson\IcqBot\Entities\PayloadNewChatMembers; | ||
|
||
try { | ||
$icq = new Antson\IcqBot\Client(TOKEN); | ||
$events = $icq->getEvents(); | ||
foreach ($events as $event){ | ||
echo $event->get_eventId().') ['.$event->get_type().'] '; | ||
|
||
$payload = $event->get_payload(); | ||
|
||
echo 'Payload instance of '.get_class($payload); | ||
echo '<br>'; | ||
|
||
switch ($event->get_type()){ | ||
case IcqEvent::NEW_MESSAGE: | ||
/** @var PayloadMessage $payload */ | ||
echo "<b>Сообщение</b> от ".$payload->get_from()->get_firstName().' '.$payload->get_from()->get_lastName().'(@'.$payload->get_from()->get_userId()."):<br>"; | ||
echo "<i>".$payload->get_text()."</i><br>"; | ||
break; | ||
|
||
case IcqEvent::NEW_CHAT_MEMBERS: | ||
/** @var PayloadNewChatMembers $payload */ | ||
echo "Пользователь ".$payload->get_addedBy()->get_firstName()." <b>добавил</b> в ".$payload->get_chat()->get_title().":<br>"; | ||
$members = $payload->get_newMembers(); | ||
foreach ($members as $member){ | ||
echo $member->get_userId().' '.$member->get_firstName().' '.$member->get_lastName(); | ||
echo "<br>"; | ||
} | ||
break; | ||
|
||
/** | ||
* other IcqEvent::CONST | ||
*/ | ||
} | ||
} | ||
} catch (Exception $e) { | ||
echo $e->getMessage(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
|
||
namespace Antson\IcqBot\Entities; | ||
|
||
/** | ||
* Отправитель сообщения / Автор действия | ||
*/ | ||
class Author extends Member | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,9 @@ | |
|
||
namespace Antson\IcqBot\Entities; | ||
|
||
|
||
/** | ||
* Разбор ответа от АПИ | ||
*/ | ||
class Entity | ||
{ | ||
/** | ||
|
Oops, something went wrong.