Add IConnector interface with corresponding types
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user