Add support for handling inline query events
This commit is contained in:
parent
a212671c49
commit
ac431136de
3 changed files with 36 additions and 0 deletions
|
@ -121,6 +121,11 @@
|
||||||
return UpdateEventType::CHOSEN_INLINE_RESULT;
|
return UpdateEventType::CHOSEN_INLINE_RESULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($update->getInlineQuery() !== null)
|
||||||
|
{
|
||||||
|
return UpdateEventType::INLINE_QUERY;
|
||||||
|
}
|
||||||
|
|
||||||
return UpdateEventType::UPDATE_EVENT;
|
return UpdateEventType::UPDATE_EVENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,6 +8,7 @@
|
||||||
use TgBotLib\Events\ChatJoinRequestEvent;
|
use TgBotLib\Events\ChatJoinRequestEvent;
|
||||||
use TgBotLib\Events\ChatMemberUpdatedEvent;
|
use TgBotLib\Events\ChatMemberUpdatedEvent;
|
||||||
use TgBotLib\Events\ChosenInlineResultEvent;
|
use TgBotLib\Events\ChosenInlineResultEvent;
|
||||||
|
use TgBotLib\Events\InlineQueryEvent;
|
||||||
use TgBotLib\Events\MyChatMemberUpdatedEvent;
|
use TgBotLib\Events\MyChatMemberUpdatedEvent;
|
||||||
use TgBotLib\Events\PollAnswerEvent;
|
use TgBotLib\Events\PollAnswerEvent;
|
||||||
use TgBotLib\Events\PollEvent;
|
use TgBotLib\Events\PollEvent;
|
||||||
|
@ -32,4 +33,5 @@
|
||||||
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;
|
case CHOSEN_INLINE_RESULT = ChosenInlineResultEvent::class;
|
||||||
|
case INLINE_QUERY = InlineQueryEvent::class;
|
||||||
}
|
}
|
||||||
|
|
29
src/TgBotLib/Events/InlineQueryEvent.php
Normal file
29
src/TgBotLib/Events/InlineQueryEvent.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\InlineQuery;
|
||||||
|
|
||||||
|
abstract class InlineQueryEvent extends UpdateEvent
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public static function getEventType(): UpdateEventType
|
||||||
|
{
|
||||||
|
return UpdateEventType::INLINE_QUERY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New incoming inline query
|
||||||
|
*
|
||||||
|
* @return InlineQuery
|
||||||
|
*/
|
||||||
|
protected function getInlineQuery(): InlineQuery
|
||||||
|
{
|
||||||
|
return $this->update->getInlineQuery();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue