add: token in env var

This commit is contained in:
starnakin 2023-10-11 18:59:09 +00:00
parent 74024e696a
commit fceef8197b

View File

@ -54,3 +54,15 @@ int get_article_data(std::string& str, unsigned int& quantity, float& price)
return 0; return 0;
} }
std::string get_token(char** av, char** env)
{
if (av[1] != NULL)
return av[1];
for (size_t i = 0; env[i] != NULL; ++i)
{
if (std::strncmp("BOT_TOKEN", env[i], 9) == 0)
return env[i] + 10;
}
return BOT_TOKEN;
}