Files
mbft-cpp/connectors/BotToken.cpp
T

35 lines
439 B
C++
Raw Normal View History

#include "connectors/BotToken.h"
#include <fstream>
#define TG_BOT_TOKEN_LENGTH 46
namespace MBFT
{
namespace BotToken
{
int get_token_length(void)
{
return TG_BOT_TOKEN_LENGTH;
}
bool load_token(char *buf)
{
buf[TG_BOT_TOKEN_LENGTH] = '\0';
std::ifstream f(".token");
if (f.is_open()) {
f.read(buf, TG_BOT_TOKEN_LENGTH);
f.close();
return true;
}
else
{
return false;
}
}
}
}