telepathy/src/telepathy/bot.cr

18 lines
521 B
Crystal
Raw Normal View History

2018-01-12 17:22:05 -08:00
require "http"
module Telepathy
class Bot
def initialize(@api_token : String)
@request_base = "https://api.telegram.org/bot#{@api_token}"
@this_user = uninitialized User?
@this_user = get_me
end
def get_me
response = HTTP::Client.get(@request_base + "/getMe",
headers: HTTP::Headers{"User-agent" => "Telepathy"})
return Response(User).from_json(response.body).result
end
end
end