TelegramByLeo/Src/TlgHandler.mqh
2026-09-25 09:59:13 -05:00

78 lines
2.9 KiB
MQL5

//+------------------------------------------------------------------+
//| TlgHandler.mqh |
//| Copyright 2026, Niquel Mendoza. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Niquel Mendoza."
#property link "https://www.mql5.com"
#property strict
#ifndef TELEGRAMBYLEO_SRC_TLGHANDLER_MQH
#define TELEGRAMBYLEO_SRC_TLGHANDLER_MQH
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include "MainAPI.mqh"
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
namespace TSN
{
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
// padre no debe de tener un contruro con parmotr o almenos tener un defualt sin eellos
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
class CTelegramBot : public CTelegramAPI
{
protected:
TlgUser m_me;
bool m_me_ready;
public:
CTelegramBot(void);
~CTelegramBot(void) {}
//---
__forceinline string UserName() const { return m_me.username; }
__forceinline string FirstName() const { return m_me.first_name; }
__forceinline string LastName() const { return m_me.last_name; }
__forceinline long Id() const { return m_me.id; }
__forceinline uint Flags() const { return m_me.flags; }
__forceinline bool MeReady() const { return m_me_ready; }
//---
bool Token(string _token); // oculta
};
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
CTelegramBot::CTelegramBot(void)
: m_me_ready(false)
{
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
bool CTelegramBot::Token(string _token)
{
if(!CTelegramAPI::Token(_token))
return false;
if(!GetMe(m_me))
return false;
m_me_ready = true;
return true;
}
}
//+------------------------------------------------------------------+
#endif // TELEGRAMBYLEO_SRC_TLGHANDLER_MQH