Add support for CallbackQuery events.
This commit is contained in:
parent
e843c8ca4f
commit
709e5794d5
3 changed files with 35 additions and 0 deletions
|
@ -111,6 +111,11 @@
|
||||||
return UpdateEventType::PRE_CHECKOUT_QUERY;
|
return UpdateEventType::PRE_CHECKOUT_QUERY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($update->getCallbackQuery() !== null)
|
||||||
|
{
|
||||||
|
return UpdateEventType::CALLBACK_QUERY;
|
||||||
|
}
|
||||||
|
|
||||||
return UpdateEventType::UPDATE_EVENT;
|
return UpdateEventType::UPDATE_EVENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,6 +3,7 @@
|
||||||
namespace TgBotLib\Enums;
|
namespace TgBotLib\Enums;
|
||||||
|
|
||||||
use TgBotLib\Abstracts\UpdateEvent;
|
use TgBotLib\Abstracts\UpdateEvent;
|
||||||
|
use TgBotLib\Events\CallbackQueryEvent;
|
||||||
use TgBotLib\Events\ChatBoostEvent;
|
use TgBotLib\Events\ChatBoostEvent;
|
||||||
use TgBotLib\Events\ChatJoinRequestEvent;
|
use TgBotLib\Events\ChatJoinRequestEvent;
|
||||||
use TgBotLib\Events\ChatMemberUpdatedEvent;
|
use TgBotLib\Events\ChatMemberUpdatedEvent;
|
||||||
|
@ -27,4 +28,5 @@
|
||||||
case PAID_MEDIA_PURCHASED = PaidMediaPurchasedEvent::class;
|
case PAID_MEDIA_PURCHASED = PaidMediaPurchasedEvent::class;
|
||||||
case PRE_CHECKOUT_QUERY = PreCheckoutQueryEvent::class;
|
case PRE_CHECKOUT_QUERY = PreCheckoutQueryEvent::class;
|
||||||
case SHIPPING_QUERY = ShippingQueryEvent::class;
|
case SHIPPING_QUERY = ShippingQueryEvent::class;
|
||||||
|
case CALLBACK_QUERY = CallbackQueryEvent::class;
|
||||||
}
|
}
|
||||||
|
|
28
src/TgBotLib/Events/CallbackQueryEvent.php
Normal file
28
src/TgBotLib/Events/CallbackQueryEvent.php
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace TgBotLib\Events;
|
||||||
|
|
||||||
|
use TgBotLib\Abstracts\UpdateEvent;
|
||||||
|
use TgBotLib\Enums\UpdateEventType;
|
||||||
|
use TgBotLib\Objects\CallbackQuery;
|
||||||
|
|
||||||
|
abstract class CallbackQueryEvent extends UpdateEvent
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getEventType(): UpdateEventType
|
||||||
|
{
|
||||||
|
return UpdateEventType::CALLBACK_QUERY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New incoming callback query
|
||||||
|
*
|
||||||
|
* @return CallbackQuery
|
||||||
|
*/
|
||||||
|
protected function getCallbackQuery(): CallbackQuery
|
||||||
|
{
|
||||||
|
return $this->update->getCallbackQuery();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue