-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved Handlers into sub namespaces for better categorization, Added a enum for ParseMode
- Loading branch information
Showing
51 changed files
with
409 additions
and
160 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,17 @@ | ||
<?php | ||
|
||
namespace Telepath\Handlers\BusinessConnection; | ||
|
||
use Attribute; | ||
use Telepath\Bot; | ||
use Telepath\Handlers\Handler; | ||
use Telepath\Telegram\Update; | ||
|
||
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] | ||
class BusinessConnection extends Handler | ||
{ | ||
public function responsible(Bot $bot, Update $update): bool | ||
{ | ||
return $update->business_connection !== null; | ||
} | ||
} |
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,17 @@ | ||
<?php | ||
|
||
namespace Telepath\Handlers\BusinessConnection; | ||
|
||
use Attribute; | ||
use Telepath\Bot; | ||
use Telepath\Handlers\Handler; | ||
use Telepath\Telegram\Update; | ||
|
||
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] | ||
class BusinessMessage extends Handler | ||
{ | ||
public function responsible(Bot $bot, Update $update): bool | ||
{ | ||
return $update->business_message !== null; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Handlers/BusinessConnection/DeletedBusinessMessages.php
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,17 @@ | ||
<?php | ||
|
||
namespace Telepath\Handlers\BusinessConnection; | ||
|
||
use Attribute; | ||
use Telepath\Bot; | ||
use Telepath\Handlers\Handler; | ||
use Telepath\Telegram\Update; | ||
|
||
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] | ||
class DeletedBusinessMessages extends Handler | ||
{ | ||
public function responsible(Bot $bot, Update $update): bool | ||
{ | ||
return $update->deleted_business_messages !== null; | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace Telepath\Handlers\BusinessConnection; | ||
|
||
use Attribute; | ||
use Telepath\Bot; | ||
use Telepath\Handlers\Handler; | ||
use Telepath\Telegram\Update; | ||
|
||
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] | ||
|
||
class EditedBusinessMessage extends Handler | ||
{ | ||
public function responsible(Bot $bot, Update $update): bool | ||
{ | ||
return $update->edited_business_message !== null; | ||
} | ||
} |
9 changes: 4 additions & 5 deletions
9
src/Handlers/CallbackQuery.php → src/Handlers/CallbackQuery/CallbackQuery.php
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 |
---|---|---|
@@ -1,18 +1,17 @@ | ||
<?php | ||
|
||
namespace Telepath\Handlers; | ||
namespace Telepath\Handlers\CallbackQuery; | ||
|
||
use Attribute; | ||
use Telepath\Telegram\Update; | ||
use Telepath\Bot; | ||
use Telepath\Handlers\Handler; | ||
use Telepath\Telegram\Update; | ||
|
||
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] | ||
class CallbackQuery extends Handler | ||
{ | ||
|
||
public function responsible(Bot $bot, Update $update): bool | ||
{ | ||
return $update->callback_query !== null; | ||
} | ||
|
||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Telepath\Handlers\ChatBoost; | ||
|
||
use Telepath\Bot; | ||
use Telepath\Handlers\Handler; | ||
use Telepath\Telegram\Update; | ||
|
||
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] | ||
class ChatBoost extends Handler | ||
{ | ||
public function responsible(Bot $bot, Update $update): bool | ||
{ | ||
return $update->chat_boost !== null; | ||
} | ||
} |
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,16 @@ | ||
<?php | ||
|
||
namespace Telepath\Handlers\ChatBoost; | ||
|
||
use Telepath\Bot; | ||
use Telepath\Handlers\Handler; | ||
use Telepath\Telegram\Update; | ||
|
||
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] | ||
class RemovedChatBoost extends Handler | ||
{ | ||
public function responsible(Bot $bot, Update $update): bool | ||
{ | ||
return $update->removed_chat_boost !== null; | ||
} | ||
} |
12 changes: 5 additions & 7 deletions
12
src/Handlers/ChatJoinRequest.php → src/Handlers/ChatMember/ChatJoinRequest.php
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 |
---|---|---|
@@ -1,18 +1,16 @@ | ||
<?php | ||
|
||
namespace Telepath\Handlers; | ||
namespace Telepath\Handlers\ChatMember; | ||
|
||
use Attribute; | ||
use Telepath\Telegram\Update; | ||
use Telepath\Bot; | ||
use Telepath\Handlers\Handler; | ||
use Telepath\Telegram\Update; | ||
|
||
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] | ||
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] | ||
class ChatJoinRequest extends Handler | ||
{ | ||
|
||
public function responsible(Bot $bot, Update $update): bool | ||
{ | ||
return $update->chat_join_request !== null; | ||
} | ||
|
||
} | ||
} |
9 changes: 4 additions & 5 deletions
9
src/Handlers/ChatMember.php → src/Handlers/ChatMember/ChatMember.php
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 |
---|---|---|
@@ -1,18 +1,17 @@ | ||
<?php | ||
|
||
namespace Telepath\Handlers; | ||
namespace Telepath\Handlers\ChatMember; | ||
|
||
use Attribute; | ||
use Telepath\Telegram\Update; | ||
use Telepath\Bot; | ||
use Telepath\Handlers\Handler; | ||
use Telepath\Telegram\Update; | ||
|
||
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] | ||
class ChatMember extends Handler | ||
{ | ||
|
||
public function responsible(Bot $bot, Update $update): bool | ||
{ | ||
return $update->chat_member !== null; | ||
} | ||
|
||
} | ||
} |
9 changes: 4 additions & 5 deletions
9
src/Handlers/MyChatMember.php → src/Handlers/ChatMember/MyChatMember.php
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 |
---|---|---|
@@ -1,18 +1,17 @@ | ||
<?php | ||
|
||
namespace Telepath\Handlers; | ||
namespace Telepath\Handlers\ChatMember; | ||
|
||
use Attribute; | ||
use Telepath\Telegram\Update; | ||
use Telepath\Bot; | ||
use Telepath\Handlers\Handler; | ||
use Telepath\Telegram\Update; | ||
|
||
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] | ||
class MyChatMember extends Handler | ||
{ | ||
|
||
public function responsible(Bot $bot, Update $update): bool | ||
{ | ||
return $update->my_chat_member !== null; | ||
} | ||
|
||
} | ||
} |
9 changes: 4 additions & 5 deletions
9
src/Handlers/PreCheckoutQuery.php → src/Handlers/Checkout/PreCheckoutQuery.php
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 |
---|---|---|
@@ -1,18 +1,17 @@ | ||
<?php | ||
|
||
namespace Telepath\Handlers; | ||
namespace Telepath\Handlers\Checkout; | ||
|
||
use Attribute; | ||
use Telepath\Telegram\Update; | ||
use Telepath\Bot; | ||
use Telepath\Handlers\Handler; | ||
use Telepath\Telegram\Update; | ||
|
||
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] | ||
class PreCheckoutQuery extends Handler | ||
{ | ||
|
||
public function responsible(Bot $bot, Update $update): bool | ||
{ | ||
return $update->pre_checkout_query !== null; | ||
} | ||
|
||
} | ||
} |
9 changes: 4 additions & 5 deletions
9
src/Handlers/ShippingQuery.php → src/Handlers/Checkout/ShippingQuery.php
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 |
---|---|---|
@@ -1,18 +1,17 @@ | ||
<?php | ||
|
||
namespace Telepath\Handlers; | ||
namespace Telepath\Handlers\Checkout; | ||
|
||
use Attribute; | ||
use Telepath\Telegram\Update; | ||
use Telepath\Bot; | ||
use Telepath\Handlers\Handler; | ||
use Telepath\Telegram\Update; | ||
|
||
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] | ||
class ShippingQuery extends Handler | ||
{ | ||
|
||
public function responsible(Bot $bot, Update $update): bool | ||
{ | ||
return $update->shipping_query !== null; | ||
} | ||
|
||
} | ||
} |
9 changes: 4 additions & 5 deletions
9
src/Handlers/ChosenInlineResult.php → ...ndlers/InlineQuery/ChosenInlineResult.php
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 |
---|---|---|
@@ -1,18 +1,17 @@ | ||
<?php | ||
|
||
namespace Telepath\Handlers; | ||
namespace Telepath\Handlers\InlineQuery; | ||
|
||
use Attribute; | ||
use Telepath\Telegram\Update; | ||
use Telepath\Bot; | ||
use Telepath\Handlers\Handler; | ||
use Telepath\Telegram\Update; | ||
|
||
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] | ||
class ChosenInlineResult extends Handler | ||
{ | ||
|
||
public function responsible(Bot $bot, Update $update): bool | ||
{ | ||
return $update->chosen_inline_result !== null; | ||
} | ||
|
||
} | ||
} |
9 changes: 4 additions & 5 deletions
9
src/Handlers/InlineQuery.php → src/Handlers/InlineQuery/InlineQuery.php
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 |
---|---|---|
@@ -1,18 +1,17 @@ | ||
<?php | ||
|
||
namespace Telepath\Handlers; | ||
namespace Telepath\Handlers\InlineQuery; | ||
|
||
use Attribute; | ||
use Telepath\Telegram\Update; | ||
use Telepath\Bot; | ||
use Telepath\Handlers\Handler; | ||
use Telepath\Telegram\Update; | ||
|
||
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)] | ||
class InlineQuery extends Handler | ||
{ | ||
|
||
public function responsible(Bot $bot, Update $update): bool | ||
{ | ||
return $update->inline_query !== null; | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.