From b0038111834ad6e3a8ea3f3b29911e72ec903bba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hauke=20Z=C3=BChl?= Date: Tue, 6 Jun 2017 13:38:35 +0200 Subject: [PATCH] Added getMe --- include/Telegram/TelegramBot.h | 3 +++ src/TelegramBot.cc | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/Telegram/TelegramBot.h b/include/Telegram/TelegramBot.h index ca90464..be1c98a 100644 --- a/include/Telegram/TelegramBot.h +++ b/include/Telegram/TelegramBot.h @@ -38,6 +38,9 @@ namespace Telegram { void addCommand(TCommand); void setWebhook(std::string); void processMessage(std::string); + + Telegram::User* getMe(void); + Telegram::Message* sendMessage(std::string, Json::Int64); Telegram::Message* sendMessage(std::string, std::string); diff --git a/src/TelegramBot.cc b/src/TelegramBot.cc index eb5d97c..16e1f89 100644 --- a/src/TelegramBot.cc +++ b/src/TelegramBot.cc @@ -84,6 +84,16 @@ void Telegram::TelegramBot::processMessage(std::string message) { } } +Telegram::User *Telegram::TelegramBot::getMe(void) { + + Json::Value obj; + std::map params; + + obj = this->apiRequestJson("getMe", params); + + return(new Telegram::User(obj["result"])); +} + /** * Send a text message to a user */