Skip to content

Commit b69792c

Browse files
committed
Version 0.7.0, PHP 7.4, PTB 0.64.0
1 parent 383cc03 commit b69792c

12 files changed

+1180
-196
lines changed

CHANGELOG.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,20 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
55

66
## [Unreleased]
77
### Added
8-
- Rules must be agreed to before allowing a user to post in the group.
98
### Changed
109
### Deprecated
1110
### Removed
1211
### Fixed
1312
### Security
1413

14+
## [0.7.0] - 2020-10-04
15+
### Added
16+
- Rules must be agreed to before allowing a user to post in the group. (#43)
17+
### Changed
18+
- Bumped dependencies, use explicit version 0.64.0 of core.
19+
### Security
20+
- Minimum PHP 7.4.
21+
1522
## [0.6.0] - 2020-07-06
1623
### Added
1724
- New `/donate` command, to allow users to donate via Telegram Payments. (#40)
@@ -59,6 +66,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
5966
- Extended `.env.example` file.
6067

6168
[Unreleased]: https://github.com/php-telegram-bot/support-bot/compare/master...develop
69+
[0.7.0]: https://github.com/php-telegram-bot/support-bot/compare/0.6.0...0.7.0
6270
[0.6.0]: https://github.com/php-telegram-bot/support-bot/compare/0.5.0...0.6.0
6371
[0.5.0]: https://github.com/php-telegram-bot/support-bot/compare/0.4.0...0.5.0
6472
[0.4.0]: https://github.com/php-telegram-bot/support-bot/compare/0.3.0...0.4.0

commands/DonateCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ protected function validateCurrency(string $currency_code)
244244
* @return int|ServerResponse
245245
* @throws TelegramException
246246
*/
247-
protected function validateAmount(string $amount, $currency)
247+
protected function validateAmount(string $amount, array $currency)
248248
{
249249
$int_amount = (int) ceil((float) $amount);
250250

commands/HelpCommand.php

-2
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,11 @@ protected function getUserAdminCommands(): array
129129
ksort($commands);
130130

131131
$user_commands = array_filter($commands, static function ($command) {
132-
/** @var Command $command */
133132
return $command->isUserCommand();
134133
});
135134
ksort($user_commands);
136135

137136
$admin_commands = array_filter($commands, static function ($command) {
138-
/** @var Command $command */
139137
return $command->isAdminCommand();
140138
});
141139
ksort($admin_commands);

commands/NewchatmembersCommand.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,22 @@ class NewchatmembersCommand extends SystemCommand
4949
/**
5050
* @var Message
5151
*/
52-
private $message;
52+
private Message $message;
5353

5454
/**
5555
* @var int
5656
*/
57-
private $chat_id;
57+
private int $chat_id;
5858

5959
/**
6060
* @var int
6161
*/
62-
private $user_id;
62+
private int $user_id;
6363

6464
/**
6565
* @var string
6666
*/
67-
private $group_name = 'PHP Telegram Support Bot';
67+
private string $group_name = 'PHP Telegram Support Bot';
6868

6969
/**
7070
* @inheritdoc
@@ -128,6 +128,7 @@ private function refreshWelcomeMessage(array $new_users): ServerResponse
128128
return Request::emptyResponse();
129129
}
130130

131+
/** @var Message $welcome_message */
131132
$welcome_message = $welcome_message_sent->getResult();
132133

133134
$new_message_id = $welcome_message->getMessageId();
@@ -206,11 +207,11 @@ private function kickDisallowedBots(array $bots): void
206207
/**
207208
* Write users join date to DB.
208209
*
209-
* @param array $new_users
210+
* @param User[] $new_users
210211
*
211212
* @return bool
212213
*/
213-
private function updateUsersJoinedDate($new_users): bool
214+
private function updateUsersJoinedDate(array $new_users): bool
214215
{
215216
$new_users_ids = array_map(static function (User $user) {
216217
return $user->getId();
@@ -227,15 +228,14 @@ private function updateUsersJoinedDate($new_users): bool
227228
/**
228229
* Restrict permissions in support group for passed users.
229230
*
230-
* @param array $new_users
231+
* @param User[] $new_users
231232
*
232233
* @return array
233234
*/
234-
private function restrictNewUsers($new_users): array
235+
private function restrictNewUsers(array $new_users): array
235236
{
236237
$responses = [];
237238

238-
/** @var User[] $new_users */
239239
foreach ($new_users as $new_user) {
240240
$user_id = $new_user->getId();
241241
$responses[$user_id] = Request::restrictChatMember([

commands/RulesCommand.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Longman\TelegramBot\Entities\InlineKeyboard;
2222
use Longman\TelegramBot\Entities\ServerResponse;
2323
use Longman\TelegramBot\Request;
24+
use PDO;
2425

2526
/**
2627
* User "/rules" command
@@ -74,7 +75,7 @@ public static function handleCallbackQuery(CallbackQuery $callback_query, array
7475
]);
7576
}
7677

77-
$give_permissions = Request::restrictChatMember([
78+
Request::restrictChatMember([
7879
'chat_id' => getenv('TG_SUPPORT_GROUP_ID'),
7980
'user_id' => $clicked_user_id,
8081
'permissions' => new ChatPermissions([
@@ -153,7 +154,7 @@ protected static function hasUserAgreedToRules(int $user_id): bool
153154
AND `activated_at` IS NOT NULL
154155
');
155156
$statement->execute([$user_id]);
156-
$agreed = $statement->fetchAll(\PDO::FETCH_COLUMN, 0);
157+
$agreed = $statement->fetchAll(PDO::FETCH_COLUMN, 0);
157158

158159
return !empty($agreed);
159160
}

composer.json

+8-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "telegram-bot/support-bot",
33
"type": "project",
44
"description": "Friendly and helpful bot for t.me/PHP_Telegram_Support_Bot",
5-
"keywords": ["telegram", "bot", "manager"],
5+
"keywords": ["telegram", "bot", "manager", "support"],
66
"license": "MIT",
77
"homepage": "https://github.com/php-telegram-bot/support-bot",
88
"support": {
@@ -17,23 +17,24 @@
1717
}
1818
],
1919
"require": {
20-
"php": ">= 7.3",
20+
"php": ">= 7.4",
2121
"ext-json": "*",
2222
"ext-pdo": "*",
2323
"php-telegram-bot/telegram-bot-manager": "^1.5",
24-
"longman/telegram-bot": "dev-master as 0.59",
24+
"longman/telegram-bot": "0.64.0 as 0.59",
2525
"noplanman/service-webhook-handler": "^0.2",
2626
"vlucas/phpdotenv": "^3.6",
2727
"php-http/guzzle6-adapter": "^1.1",
28-
"knplabs/github-api": "^2.12",
28+
"knplabs/github-api": "^2.15",
2929
"elvanto/litemoji": "^1.4",
30-
"monolog/monolog": "^2.0",
30+
"monolog/monolog": "^2.1",
3131
"matthiasmullie/scrapbook": "^1.4"
3232
},
3333
"require-dev": {
34+
"roave/security-advisories": "dev-master",
3435
"squizlabs/php_codesniffer": "^3.5",
35-
"jakub-onderka/php-parallel-lint": "^1.0",
36-
"symfony/var-dumper": "^5.0"
36+
"php-parallel-lint/php-parallel-lint": "^1.2",
37+
"symfony/var-dumper": "^5.1"
3738
},
3839
"autoload": {
3940
"psr-4": {

0 commit comments

Comments
 (0)