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

Show who's joined a game on the game view, with profile photos #27

Open
dkhgh opened this issue Apr 25, 2016 · 2 comments
Open

Show who's joined a game on the game view, with profile photos #27

dkhgh opened this issue Apr 25, 2016 · 2 comments

Comments

@dkhgh
Copy link
Member

dkhgh commented Apr 25, 2016

Did some experimenting with the photos:

Telegram::Bot::Client.run(token) do |bot|
  bot.api.get_user_profile_photos(user_id: fake-user-id)
end

returns the following

{"ok"=>true,
 "result"=>
  {"total_count"=>1,
   "photos"=>
    [[{"file_id"=>fake-file-id, "file_size"=>8786, "width"=>160, "height"=>160},
      {"file_id"=>fake-file-id-2, "file_size"=>23897, "width"=>320, "height"=>320},
      {"file_id"=>fake-file-id-3, "file_size"=>62566, "width"=>640, "height"=>640}]]}}

Did some experimenting with getting profile pics:

Now we can request a link for one of those files:

Telegram::Bot::Client.run(token) do |bot|
  bot.api.get_file(file_id: fake-file-id)
end

This returns:

{"ok"=>true, "result"=>{"file_id"=> fake-file-id, "file_size"=>8786, "file_path"=>"photo/file_0.jpg"}}

The photo can now be downloaded from: https://api.telegram.org/file/bot<token>/photo/file_0.jpg

(Link expires after a while though).

@jurre
Copy link
Contributor

jurre commented Apr 25, 2016

Nice, we could spawn background tasks to do the downloading (using Sidekiq f.e) and store them in S3

@dkhgh
Copy link
Member Author

dkhgh commented Apr 25, 2016

Nice, we could create an operation to create a player, and spawn something from there?

And make sure we update any find_or_create's in /commands
https://github.com/DefactoSoftware/PickupGameBot/blob/master/lib/pickup_bot/commands/join.rb#L14

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

No branches or pull requests

2 participants