Skip to content

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

@dkhgh

Description

@dkhgh

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions