Add support for ChosenInlineResult events
This commit is contained in:
parent
709e5794d5
commit
a212671c49
3 changed files with 37 additions and 0 deletions
|
@ -116,6 +116,11 @@
|
||||||
return UpdateEventType::CALLBACK_QUERY;
|
return UpdateEventType::CALLBACK_QUERY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($update->getChosenInlineResult() !== null)
|
||||||
|
{
|
||||||
|
return UpdateEventType::CHOSEN_INLINE_RESULT;
|
||||||
|
}
|
||||||
|
|
||||||
return UpdateEventType::UPDATE_EVENT;
|
return UpdateEventType::UPDATE_EVENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,6 +7,7 @@
|
||||||
use TgBotLib\Events\ChatBoostEvent;
|
use TgBotLib\Events\ChatBoostEvent;
|
||||||
use TgBotLib\Events\ChatJoinRequestEvent;
|
use TgBotLib\Events\ChatJoinRequestEvent;
|
||||||
use TgBotLib\Events\ChatMemberUpdatedEvent;
|
use TgBotLib\Events\ChatMemberUpdatedEvent;
|
||||||
|
use TgBotLib\Events\ChosenInlineResultEvent;
|
||||||
use TgBotLib\Events\MyChatMemberUpdatedEvent;
|
use TgBotLib\Events\MyChatMemberUpdatedEvent;
|
||||||
use TgBotLib\Events\PollAnswerEvent;
|
use TgBotLib\Events\PollAnswerEvent;
|
||||||
use TgBotLib\Events\PollEvent;
|
use TgBotLib\Events\PollEvent;
|
||||||
|
@ -14,6 +15,7 @@
|
||||||
use TgBotLib\Events\PreCheckoutQueryEvent;
|
use TgBotLib\Events\PreCheckoutQueryEvent;
|
||||||
use TgBotLib\Events\RemovedChatBoostEvent;
|
use TgBotLib\Events\RemovedChatBoostEvent;
|
||||||
use TgBotLib\Events\ShippingQueryEvent;
|
use TgBotLib\Events\ShippingQueryEvent;
|
||||||
|
use TgBotLib\Objects\Inline\ChosenInlineResult;
|
||||||
|
|
||||||
enum UpdateEventType : string
|
enum UpdateEventType : string
|
||||||
{
|
{
|
||||||
|
@ -29,4 +31,5 @@
|
||||||
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;
|
case CALLBACK_QUERY = CallbackQueryEvent::class;
|
||||||
|
case CHOSEN_INLINE_RESULT = ChosenInlineResultEvent::class;
|
||||||
}
|
}
|
||||||
|
|
29
src/TgBotLib/Events/ChosenInlineResultEvent.php
Normal file
29
src/TgBotLib/Events/ChosenInlineResultEvent.php
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace TgBotLib\Events;
|
||||||
|
|
||||||
|
use TgBotLib\Abstracts\UpdateEvent;
|
||||||
|
use TgBotLib\Bot;
|
||||||
|
use TgBotLib\Enums\UpdateEventType;
|
||||||
|
use TgBotLib\Objects\Inline\ChosenInlineResult;
|
||||||
|
|
||||||
|
abstract class ChosenInlineResultEvent extends UpdateEvent
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getEventType(): UpdateEventType
|
||||||
|
{
|
||||||
|
return UpdateeventType::CHOSEN_INLINE_RESULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the chosen inline result from the current update.
|
||||||
|
*
|
||||||
|
* @return ChosenInlineResult The chosen inline result associated with the current update.
|
||||||
|
*/
|
||||||
|
protected function getChosenInlineResult(): ChosenInlineResult
|
||||||
|
{
|
||||||
|
return $this->update->getChosenInlineResult();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue