Skip to content

Commit 24172a6

Browse files
committed
Added missing Handlers,
moved Handlers into sub namespaces for better categorization, Added a enum for ParseMode
1 parent 8fedb4a commit 24172a6

51 files changed

Lines changed: 409 additions & 160 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Telepath\Handlers\BusinessConnection;
4+
5+
use Attribute;
6+
use Telepath\Bot;
7+
use Telepath\Handlers\Handler;
8+
use Telepath\Telegram\Update;
9+
10+
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
11+
class BusinessConnection extends Handler
12+
{
13+
public function responsible(Bot $bot, Update $update): bool
14+
{
15+
return $update->business_connection !== null;
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Telepath\Handlers\BusinessConnection;
4+
5+
use Attribute;
6+
use Telepath\Bot;
7+
use Telepath\Handlers\Handler;
8+
use Telepath\Telegram\Update;
9+
10+
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
11+
class BusinessMessage extends Handler
12+
{
13+
public function responsible(Bot $bot, Update $update): bool
14+
{
15+
return $update->business_message !== null;
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Telepath\Handlers\BusinessConnection;
4+
5+
use Attribute;
6+
use Telepath\Bot;
7+
use Telepath\Handlers\Handler;
8+
use Telepath\Telegram\Update;
9+
10+
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
11+
class DeletedBusinessMessages extends Handler
12+
{
13+
public function responsible(Bot $bot, Update $update): bool
14+
{
15+
return $update->deleted_business_messages !== null;
16+
}
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Telepath\Handlers\BusinessConnection;
4+
5+
use Attribute;
6+
use Telepath\Bot;
7+
use Telepath\Handlers\Handler;
8+
use Telepath\Telegram\Update;
9+
10+
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
11+
12+
class EditedBusinessMessage extends Handler
13+
{
14+
public function responsible(Bot $bot, Update $update): bool
15+
{
16+
return $update->edited_business_message !== null;
17+
}
18+
}
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
<?php
22

3-
namespace Telepath\Handlers;
3+
namespace Telepath\Handlers\CallbackQuery;
44

55
use Attribute;
6-
use Telepath\Telegram\Update;
76
use Telepath\Bot;
7+
use Telepath\Handlers\Handler;
8+
use Telepath\Telegram\Update;
89

910
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
1011
class CallbackQuery extends Handler
1112
{
12-
1313
public function responsible(Bot $bot, Update $update): bool
1414
{
1515
return $update->callback_query !== null;
1616
}
17-
18-
}
17+
}

src/Handlers/CallbackQuery/CallbackQueryData.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,20 @@
33
namespace Telepath\Handlers\CallbackQuery;
44

55
use Attribute;
6-
use Telepath\Handlers\CallbackQuery;
6+
use Telepath\Bot;
77
use Telepath\MatchMaker\MatchMaker;
88
use Telepath\Telegram\Update;
9-
use Telepath\Bot;
109

1110
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
1211
class CallbackQueryData extends CallbackQuery
1312
{
14-
1513
public function __construct(
1614
protected ?string $exact = null,
1715
protected ?string $prefix = null,
1816
protected ?string $regex = null,
1917
protected ?string $suffix = null,
20-
) {}
18+
) {
19+
}
2120

2221
public function responsible(Bot $bot, Update $update): bool
2322
{
@@ -38,5 +37,4 @@ public function responsible(Bot $bot, Update $update): bool
3837
->suffix($this->suffix)
3938
->result();
4039
}
41-
42-
}
40+
}
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33
namespace Telepath\Handlers;
44

55
use Attribute;
6-
use Telepath\Telegram\Update;
76
use Telepath\Bot;
7+
use Telepath\Telegram\Update;
88

99
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
1010
class ChannelPost extends Handler
1111
{
12-
1312
public function responsible(Bot $bot, Update $update): bool
1413
{
1514
return $update->channel_post !== null;
1615
}
17-
18-
}
16+
}

src/Handlers/EditedChannelPost.php renamed to src/Handlers/Channel/EditedChannelPost.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33
namespace Telepath\Handlers;
44

55
use Attribute;
6-
use Telepath\Telegram\Update;
76
use Telepath\Bot;
7+
use Telepath\Telegram\Update;
88

99
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
1010
class EditedChannelPost extends Handler
1111
{
12-
1312
public function responsible(Bot $bot, Update $update): bool
1413
{
1514
return $update->edited_channel_post !== null;
1615
}
17-
18-
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Telepath\Handlers\ChatBoost;
4+
5+
use Telepath\Bot;
6+
use Telepath\Handlers\Handler;
7+
use Telepath\Telegram\Update;
8+
9+
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
10+
class ChatBoost extends Handler
11+
{
12+
public function responsible(Bot $bot, Update $update): bool
13+
{
14+
return $update->chat_boost !== null;
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Telepath\Handlers\ChatBoost;
4+
5+
use Telepath\Bot;
6+
use Telepath\Handlers\Handler;
7+
use Telepath\Telegram\Update;
8+
9+
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
10+
class RemovedChatBoost extends Handler
11+
{
12+
public function responsible(Bot $bot, Update $update): bool
13+
{
14+
return $update->removed_chat_boost !== null;
15+
}
16+
}

0 commit comments

Comments
 (0)