Skip to content
This repository has been archived by the owner on Dec 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #165 from seregazhuk/develop
Browse files Browse the repository at this point in the history
add: User isBanned and getUserName methods
  • Loading branch information
seregazhuk authored Sep 12, 2016
2 parents 339f506 + 4c2168d commit f1a35dc
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Change Log
All notable changes to this project will be documented in this file.

## [4.10.0] - 2016-09-12
### Added
- User *isBanned* and *getUserName* methods

## [4.9.0] - 2016-09-11
### Added:
- Get user profile info
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,17 @@ echo $profile['username']; //prints your username
```
In result you can find your username, and all your account settings.

Get your current username:
```php
$username = $bot->user->getUserName();
```

Check if your account is banned:
```php
if ($bot->user->isBanned() {
// ... you have ban
}

## News
Get last user's news.
```php
Expand Down
22 changes: 22 additions & 0 deletions src/Api/Providers/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,28 @@ public function isLoggedIn()
return $this->request->isLoggedIn();
}

/**
* Checks if current user is banned
*
* @return bool
*/
public function isBanned()
{
$profile = $this->profile();

return (bool)$profile['is_write_banned'];
}

/**
* Returns current user username
*
* @return string
*/
public function getUserName()
{
return $this->profile()['username'];
}

/**
* Validates password and login.
*
Expand Down

0 comments on commit f1a35dc

Please sign in to comment.