telepathy/src/telepathy/bot.cr

18 lines
521 B
Crystal

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