Skip to content

Commit e2cec4c

Browse files
authored
Merge pull request #14 from php-telegram-bot/develop
Version 0.43.0
2 parents d50df8f + 2383242 commit e2cec4c

16 files changed

+265
-80
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ sudo: required
22
language: php
33

44
addons:
5-
mariadb: 10.1
5+
mariadb: 10.1
66

77
cache:
88
directories:
9-
- $HOME/.composer/cache
9+
- "$HOME/.composer/cache"
1010

1111
matrix:
1212
include:
@@ -39,10 +39,10 @@ before_script:
3939
script:
4040
- composer check-code
4141
- if [[ "$COVERAGE" == "1" ]] ; then composer test-cov-live; fi
42-
- if [[ "$COVERAGE" != "1" ]] ; then composer test-live; fi
42+
- if [[ "$COVERAGE" != "1" ]] ; then composer test; fi
4343

4444
after_success:
45-
- if [[ "$COVERAGE" == "1" ]]; then bash <(curl -s https://codecov.io/bash); fi
45+
- if [[ "$COVERAGE" == "1" ]]; then composer test-cov-upload; fi
4646

4747
env:
4848
global:

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
33

44
## [Unreleased]
55

6+
## [0.43.0] - 2017-04-17
7+
### Added
8+
- PHP CodeSniffer introduced and cleaned code to pass tests.
9+
- Custom exceptions for better error handling.
10+
- Request limiter options.
11+
612
## [0.42.0.1] - 2017-04-11
713
### Added
814
- Changelog.

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Installation and usage is pretty straight forward:
2020
Either run this command in your command line:
2121

2222
```bash
23-
composer require noplanman/telegram-bot-manager:^0.42
23+
composer require noplanman/telegram-bot-manager:^0.43
2424
```
2525

2626
**or**
@@ -29,7 +29,7 @@ For existing Composer projects, edit your project's `composer.json` file to requ
2929

3030
```yaml
3131
"require": {
32-
"noplanman/telegram-bot-manager": "^0.42"
32+
"noplanman/telegram-bot-manager": "^0.43"
3333
}
3434
```
3535
and then run `composer update`
@@ -161,14 +161,14 @@ Here is a list of available extra parameters:
161161
| *string* | *e.g.* `'https://example.com/manager.php'` |
162162
| certificate | Path to a self-signed certificate (if necessary). |
163163
| *string* | *e.g.* `__DIR__ . '/server.crt'` |
164-
| max_connections | Maximum allowed simultaneous HTTPS connections to the webhook |
164+
| max_connections | Maximum allowed simultaneous HTTPS connections to the webhook. |
165165
| *int* | *e.g.* `20` |
166-
| allowed_updates | List the types of updates you want your bot to receive |
166+
| allowed_updates | List the types of updates you want your bot to receive. |
167167
| *array* | *e.g.* `['message', 'edited_channel_post', 'callback_query']` |
168168
| logging | Path(s) where to the log files should be put. This is an array that can contain all 3 log file paths (`error`, `debug` and `update`). |
169169
| *array* | *e.g.* `['error' => __DIR__ . '/php-telegram-bot-error.log']` |
170-
| limiter | Enable or disable the limiter functionality |
171-
| *bool* | *e.g.* `true` or `false` |
170+
| limiter | Enable or disable the limiter functionality, also accepts options array. |
171+
| *bool|array* | *e.g.* `true` or `false` or `['interval' => 2]` |
172172
| admins | An array of user ids that have admin access to your bot. |
173173
| *array* | *e.g.* `[12345]` |
174174
| mysql | Mysql credentials to connect a database (necessary for [`getUpdates`](#using-getupdates-method) method!). |

composer.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
],
2020
"require": {
2121
"php": "^7.0",
22-
"longman/telegram-bot": "^0.42"
22+
"longman/telegram-bot": "^0.43"
2323
},
2424
"require-dev": {
2525
"jakub-onderka/php-parallel-lint": "^0.9.2",
26-
"phpunit/phpunit": "^6.1"
26+
"phpunit/phpunit": "^6.1",
27+
"squizlabs/php_codesniffer": "^2.8"
2728
},
2829
"autoload": {
2930
"psr-4": {
@@ -37,19 +38,23 @@
3738
},
3839
"scripts": {
3940
"check-code": [
40-
"parallel-lint . --exclude vendor"
41+
"vendor/bin/parallel-lint . --exclude vendor",
42+
"vendor/bin/phpcs --standard=psr2 src/ tests/ -snp --encoding=utf-8 --report-width=150"
4143
],
4244
"test": [
43-
"phpunit --exclude-group live"
45+
"vendor/bin/phpunit --exclude-group live"
4446
],
4547
"test-live": [
46-
"phpunit"
48+
"vendor/bin/phpunit"
4749
],
4850
"test-cov": [
49-
"phpunit --coverage-clover=coverage.xml --exclude-group live"
51+
"vendor/bin/phpunit --coverage-clover=coverage.xml --exclude-group live"
5052
],
5153
"test-cov-live": [
52-
"phpunit --coverage-clover=coverage.xml"
54+
"vendor/bin/phpunit --coverage-clover=coverage.xml"
55+
],
56+
"test-cov-upload": [
57+
"curl -s https://codecov.io/bash | bash"
5358
]
5459
}
5560
}

composer.lock

Lines changed: 100 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Action.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
namespace NPM\TelegramBotManager;
1212

13+
use NPM\TelegramBotManager\Exception\InvalidActionException;
14+
1315
class Action
1416
{
1517
/**
@@ -32,14 +34,14 @@ class Action
3234
*
3335
* @param string $action
3436
*
35-
* @throws \InvalidArgumentException
37+
* @throws \NPM\TelegramBotManager\Exception\InvalidActionException
3638
*/
3739
public function __construct($action = 'handle')
3840
{
3941
$this->action = $action ?: 'handle';
4042

4143
if (!$this->isAction(self::$valid_actions)) {
42-
throw new \InvalidArgumentException('Invalid action: ' . $this->action);
44+
throw new InvalidActionException('Invalid action: ' . $this->action);
4345
}
4446
}
4547

0 commit comments

Comments
 (0)