Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit690b712

Browse files
committed
[Notifier] added telegram options
1 parent2460ca5 commit690b712

File tree

11 files changed

+416
-9
lines changed

11 files changed

+416
-9
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\Telegram\Reply\Markup;
13+
14+
/**
15+
* @author Mihail Krasilnikov <mihail.krasilnikov.j@gmail.com>
16+
*/
17+
abstractclass AbstractTelegramReplyMarkup
18+
{
19+
protected$options = [];
20+
21+
publicfunctiontoArray():array
22+
{
23+
return$this->options;
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\Telegram\Reply\Markup\Button;
13+
14+
/**
15+
* @author Mihail Krasilnikov <mihail.krasilnikov.j@gmail.com>
16+
*/
17+
abstractclass AbstractKeyboardButton
18+
{
19+
protected$options = [];
20+
21+
publicfunctiontoArray():array
22+
{
23+
return$this->options;
24+
}
25+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\Telegram\Reply\Markup\Button;
13+
14+
/**
15+
* @author Mihail Krasilnikov <mihail.krasilnikov.j@gmail.com>
16+
* @see https://core.telegram.org/bots/api#inlinekeyboardbutton
17+
*/
18+
class InlineKeyboardButtonextends AbstractKeyboardButton
19+
{
20+
publicfunction__construct(string$text ='')
21+
{
22+
$this->options['text'] =$text;
23+
}
24+
25+
publicfunctionurl(string$url):self
26+
{
27+
$this->options['url'] =$url;
28+
29+
return$this;
30+
}
31+
32+
publicfunctionloginUrl(string$url):self
33+
{
34+
$this->options['login_url']['url'] =$url;
35+
36+
return$this;
37+
}
38+
39+
publicfunctionloginUrlForwardText(string$text):self
40+
{
41+
$this->options['login_url']['forward_text'] =$text;
42+
43+
return$this;
44+
}
45+
46+
publicfunctionrequestWriteAccess(bool$bool):self
47+
{
48+
$this->options['login_url']['request_write_access'] =$bool;
49+
50+
return$this;
51+
}
52+
53+
publicfunctioncallbackData(string$data):self
54+
{
55+
$this->options['callback_data'] =$data;
56+
57+
return$this;
58+
}
59+
60+
publicfunctionswitchInlineQuery(string$query):self
61+
{
62+
$this->options['switch_inline_query'] =$query;
63+
64+
return$this;
65+
}
66+
67+
publicfunctionpayButton(bool$bool):self
68+
{
69+
$this->options['pay'] =$bool;
70+
71+
return$this;
72+
}
73+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\Telegram\Reply\Markup\Button;
13+
14+
/**
15+
* @author Mihail Krasilnikov <mihail.krasilnikov.j@gmail.com>
16+
* @see https://core.telegram.org/bots/api#keyboardbutton
17+
*/
18+
class KeyboardButtonextends AbstractKeyboardButton
19+
{
20+
publicfunction__construct(string$text)
21+
{
22+
$this->options['text'] =$text;
23+
}
24+
25+
publicfunctionrequestContact(bool$bool):self
26+
{
27+
$this->options['request_contact'] =$bool;
28+
29+
return$this;
30+
}
31+
32+
publicfunctionrequestLocation(bool$bool):self
33+
{
34+
$this->options['request_location'] =$bool;
35+
36+
return$this;
37+
}
38+
39+
publicfunctionrequestPollType(string$type):self
40+
{
41+
$this->options['request_contact']['type'] =$type;
42+
43+
return$this;
44+
}
45+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\Telegram\Reply\Markup;
13+
14+
/**
15+
* @author Mihail Krasilnikov <mihail.krasilnikov.j@gmail.com>
16+
* @see https://core.telegram.org/bots/api#forcereply
17+
*/
18+
class ForceReplyextends AbstractTelegramReplyMarkup
19+
{
20+
publicfunction__construct(bool$forceReply =false,bool$selective =false)
21+
{
22+
$this->options['force_reply'] =$forceReply;
23+
$this->options['selective'] =$selective;
24+
}
25+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\Telegram\Reply\Markup;
13+
14+
useSymfony\Component\Notifier\Bridge\Telegram\Reply\Markup\Button\InlineKeyboardButton;
15+
16+
/**
17+
* @author Mihail Krasilnikov <mihail.krasilnikov.j@gmail.com>
18+
* @see https://core.telegram.org/bots/api#inlinekeyboardmarkup
19+
*/
20+
class InlineKeyboardMarkupextends AbstractTelegramReplyMarkup
21+
{
22+
publicfunction__construct()
23+
{
24+
$this->options['inline_keyboard'] = [];
25+
}
26+
27+
/**
28+
* @param array|InlineKeyboardButton[] $buttons
29+
*/
30+
publicfunctioninlineKeyboard(array$buttons):self
31+
{
32+
$buttons =\array_map(staticfunction (InlineKeyboardButton$button) {
33+
return$button->toArray();
34+
},$buttons);
35+
36+
$this->options['inline_keyboard'][] =$buttons;
37+
return$this;
38+
}
39+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\Telegram\Reply\Markup;
13+
14+
useSymfony\Component\Notifier\Bridge\Telegram\Reply\Markup\Button\KeyboardButton;
15+
16+
/**
17+
* @author Mihail Krasilnikov <mihail.krasilnikov.j@gmail.com>
18+
* @see https://core.telegram.org/bots/api#replykeyboardmarkup
19+
*/
20+
class ReplyKeyboardMarkupextends AbstractTelegramReplyMarkup
21+
{
22+
publicfunction__construct()
23+
{
24+
$this->options['keyboard'] = [];
25+
}
26+
27+
publicfunctionkeyboard(array$buttons):self
28+
{
29+
$buttons =\array_map(staticfunction (KeyboardButton$button) {
30+
return$button->toArray();
31+
},$buttons);
32+
33+
$this->options['keyboard'][] =$buttons;
34+
35+
return$this;
36+
}
37+
38+
publicfunctionresizeKeyboard(bool$bool):self
39+
{
40+
$this->options['resize_keyboard'] =$bool;
41+
42+
return$this;
43+
}
44+
45+
publicfunctiononeTimeKeyboard(bool$bool):self
46+
{
47+
$this->options['one_time_keyboard'] =$bool;
48+
49+
return$this;
50+
}
51+
52+
publicfunctionselective(bool$bool):self
53+
{
54+
$this->options['selective'] =$bool;
55+
56+
return$this;
57+
}
58+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Notifier\Bridge\Telegram\Reply\Markup;
13+
14+
/**
15+
* @author Mihail Krasilnikov <mihail.krasilnikov.j@gmail.com>
16+
* @see https://core.telegram.org/bots/api#replykeyboardremove
17+
*/
18+
class ReplyKeyboardRemoveextends AbstractTelegramReplyMarkup
19+
{
20+
publicfunction__construct(bool$removeKeyboard =false,bool$selective =false)
21+
{
22+
$this->options['remove_keyboard'] =$removeKeyboard;
23+
$this->options['selective'] =$selective;
24+
}
25+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp