Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add getUserProfilePhotos method #35

Closed
wants to merge 1 commit into from
Closed

add getUserProfilePhotos method #35

wants to merge 1 commit into from

Conversation

feralheart
Copy link
Contributor

I made these changes for the Issue #33
Documentation:

@codecov
Copy link

codecov bot commented Mar 24, 2018

Codecov Report

Merging #35 into master will decrease coverage by 3.2%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #35      +/-   ##
============================================
- Coverage     77.68%   74.48%   -3.21%     
- Complexity      116      121       +5     
============================================
  Files            11       11              
  Lines           372      388      +16     
============================================
  Hits            289      289              
- Misses           83       99      +16
Impacted Files Coverage Δ Complexity Δ
src/TelegramDriver.php 84.88% <0%> (-8.71%) 50 <5> (+5)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 45ed1e8...759da85. Read the comment docs.

@mpociot
Copy link
Member

mpociot commented Apr 5, 2018

@feralheart Thank you for the PR. Hm I wonder if we should add this to the Telegram User object.

@feralheart
Copy link
Contributor Author

@mpociot You're welcome. I thinked about it, too, but I didn't want to break the getUser method.

@mpociot
Copy link
Member

mpociot commented Apr 9, 2018

I don't think that we break it. The Telegram driver already has a custom user object that gets returned: https://github.com/botman/driver-telegram/blob/master/src/Extensions/User.php
So we could add a setter / getter for the image and pass the image to the object when it gets created.

@feralheart
Copy link
Contributor Author

It's a good idea. I will do it :)

if ($responsePhotoFile->getStatusCode() !== 200) {
throw new TelegramException('Error retrieving user photos info: '.$responseDataPhotoFile['description']);
}
$userProfilePhotoPaths[] = 'https://api.telegram.org/file/bot'.env('TELEGRAM_TOKEN').'/'.$responseDataPhotoFile['result']['file_path'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Environment variable 'TELEGRAM_TOKEN' is hardcoded here. Maybe it is better to retrieve the token from $this->config?

@antimech
Copy link
Contributor

@mpociot so? Merge maybe?

@antimech
Copy link
Contributor

@feralheart any upd?

@filippotoso
Copy link
Contributor

Move this to the User object, replace the env() call with $this->config() and I'll approve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants