go into command manager
Signed-off-by: Aleksey Selihov <faumaray@gmail.com>
This commit is contained in:
1 parent
b94b634a87
commit
1153721546
19 files changed
+752
-229
No files matched your search
@@ -49,37 +49,6 @@ namespace ts6bot
|
||||
MusicConfig music{};
|
||||
ProxyConfiguration proxy{};
|
||||
};
|
||||
|
||||
class Configuration : public Singleton<Configuration>
|
||||
{
|
||||
friend class Singleton<Configuration>;
|
||||
|
||||
public:
|
||||
|
||||
const Config getConfig() const noexcept { return m_config; }
|
||||
|
||||
Configuration(std::string path)
|
||||
{
|
||||
auto config = Config();
|
||||
std::string buffer;
|
||||
auto ec = glz::read_file_json(config, path, buffer);
|
||||
if (ec) {
|
||||
std::string descriptive_error =
|
||||
glz::format_error(ec, buffer);
|
||||
std::cerr << "Not found configuration in " << path
|
||||
<< " using default" << std::endl;
|
||||
std::cerr << descriptive_error << std::endl;
|
||||
std::cerr << ec.ec << std::endl;
|
||||
m_config = Config();
|
||||
}
|
||||
this->m_config = config;
|
||||
}
|
||||
|
||||
Config m_config{};
|
||||
};
|
||||
|
||||
// Glaze meta (explicit, stable)
|
||||
|
||||
} // namespace ts6bot
|
||||
template <> struct glz::meta<ProxyType> {
|
||||
using enum ProxyType;
|
||||
@@ -88,7 +57,7 @@ template <> struct glz::meta<ProxyType> {
|
||||
template <> struct glz::meta<ts6bot::LogLevel> {
|
||||
using enum ts6bot::LogLevel;
|
||||
static constexpr auto value =
|
||||
enumerate(Critical, Error, Warning, Info, Trace);
|
||||
enumerate(Trace, Debug, Info, Warning, Error, Critical, None);
|
||||
};
|
||||
template <> struct glz::meta<ts6bot::ServerQueryConfig> {
|
||||
using T = ts6bot::ServerQueryConfig;
|
||||
@@ -124,3 +93,37 @@ template <> struct glz::meta<ts6bot::Config> {
|
||||
"password", &T::password, "loggingLevel", &T::loggingLevel, "afk",
|
||||
&T::afk, "music", &T::music, "proxy", &T::proxy);
|
||||
};
|
||||
namespace ts6bot
|
||||
{
|
||||
class Configuration : public Singleton<Configuration>
|
||||
{
|
||||
friend class Singleton<Configuration>;
|
||||
|
||||
public:
|
||||
|
||||
const Config getConfig() const noexcept { return m_config; }
|
||||
|
||||
Configuration(std::string path)
|
||||
{
|
||||
auto config = Config();
|
||||
std::string buffer;
|
||||
auto ec = glz::read_file_json(config, path, buffer);
|
||||
if (ec) {
|
||||
std::string descriptive_error =
|
||||
glz::format_error(ec, buffer);
|
||||
std::cerr << "Not found configuration in " << path
|
||||
<< " using default" << std::endl;
|
||||
std::cerr << descriptive_error << std::endl;
|
||||
std::cerr << ec.ec << std::endl;
|
||||
m_config = Config();
|
||||
}
|
||||
this->m_config = config;
|
||||
}
|
||||
|
||||
Config m_config{};
|
||||
};
|
||||
|
||||
// Glaze meta (explicit, stable)
|
||||
|
||||
} // namespace ts6bot
|
||||
|
||||
Reference in new issue
Block a user