comment unused code, dont overwrite source language

This commit is contained in:
Syping 2024-02-10 13:12:50 +01:00
parent 10135e6ec1
commit f74e354901
5 changed files with 10 additions and 1 deletions

View file

@ -82,6 +82,7 @@ std::vector<dpp::snowflake> database::get_channels(dpp::snowflake guild_id)
return {}; return {};
} }
/*
std::string database::get_channel_source(dpp::snowflake guild_id, dpp::snowflake channel_id) std::string database::get_channel_source(dpp::snowflake guild_id, dpp::snowflake channel_id)
{ {
#ifndef NDEBUG #ifndef NDEBUG
@ -97,6 +98,7 @@ std::vector<bot::settings::target> database::get_channel_targets(dpp::snowflake
#endif #endif
return {}; return {};
} }
*/
std::vector<dpp::snowflake> database::get_guilds() std::vector<dpp::snowflake> database::get_guilds()
{ {

View file

@ -39,8 +39,10 @@ namespace bot {
virtual std::variant<std::monostate,bot::settings::target> find_channel_target(dpp::snowflake guild_id, dpp::snowflake channel_id, const std::string &target); virtual std::variant<std::monostate,bot::settings::target> find_channel_target(dpp::snowflake guild_id, dpp::snowflake channel_id, const std::string &target);
virtual bot::settings::channel get_channel(dpp::snowflake guild_id, dpp::snowflake channel_id); virtual bot::settings::channel get_channel(dpp::snowflake guild_id, dpp::snowflake channel_id);
virtual std::vector<dpp::snowflake> get_channels(dpp::snowflake guild_id); virtual std::vector<dpp::snowflake> get_channels(dpp::snowflake guild_id);
/* unused atm.
virtual std::string get_channel_source(dpp::snowflake guild_id, dpp::snowflake channel_id); virtual std::string get_channel_source(dpp::snowflake guild_id, dpp::snowflake channel_id);
virtual std::vector<bot::settings::target> get_channel_targets(dpp::snowflake guild_id, dpp::snowflake channel_id); virtual std::vector<bot::settings::target> get_channel_targets(dpp::snowflake guild_id, dpp::snowflake channel_id);
*/
virtual std::vector<dpp::snowflake> get_guilds(); virtual std::vector<dpp::snowflake> get_guilds();
virtual void set_channel_source(dpp::snowflake guild_id, dpp::snowflake channel_id, const std::string &source); virtual void set_channel_source(dpp::snowflake guild_id, dpp::snowflake channel_id, const std::string &source);
virtual bool sync(); virtual bool sync();

View file

@ -286,6 +286,7 @@ std::vector<dpp::snowflake> file::get_channels(dpp::snowflake guild_id)
return channels; return channels;
} }
/*
std::string file::get_channel_source(dpp::snowflake guild_id, dpp::snowflake channel_id) std::string file::get_channel_source(dpp::snowflake guild_id, dpp::snowflake channel_id)
{ {
const std::lock_guard<std::mutex> guard(m_mutex); const std::lock_guard<std::mutex> guard(m_mutex);
@ -324,6 +325,7 @@ std::vector<bot::settings::target> file::get_channel_targets(dpp::snowflake guil
cache_get_channel(channel_id, &channel); cache_get_channel(channel_id, &channel);
return channel.targets; return channel.targets;
} }
*/
std::vector<dpp::snowflake> file::get_guilds() std::vector<dpp::snowflake> file::get_guilds()
{ {

View file

@ -36,8 +36,10 @@ namespace bot {
std::variant<std::monostate,bot::settings::target> find_channel_target(dpp::snowflake guild_id, dpp::snowflake channel_id, const std::string &target) override; std::variant<std::monostate,bot::settings::target> find_channel_target(dpp::snowflake guild_id, dpp::snowflake channel_id, const std::string &target) override;
bot::settings::channel get_channel(dpp::snowflake guild_id, dpp::snowflake channel_id) override; bot::settings::channel get_channel(dpp::snowflake guild_id, dpp::snowflake channel_id) override;
std::vector<dpp::snowflake> get_channels(dpp::snowflake guild_id) override; std::vector<dpp::snowflake> get_channels(dpp::snowflake guild_id) override;
/* unused atm.
std::string get_channel_source(dpp::snowflake guild_id, dpp::snowflake channel_id) override; std::string get_channel_source(dpp::snowflake guild_id, dpp::snowflake channel_id) override;
std::vector<bot::settings::target> get_channel_targets(dpp::snowflake guild_id, dpp::snowflake channel_id) override; std::vector<bot::settings::target> get_channel_targets(dpp::snowflake guild_id, dpp::snowflake channel_id) override;
*/
std::vector<dpp::snowflake> get_guilds() override; std::vector<dpp::snowflake> get_guilds() override;
void set_channel_source(dpp::snowflake guild_id, dpp::snowflake channel_id, const std::string &source) override; void set_channel_source(dpp::snowflake guild_id, dpp::snowflake channel_id, const std::string &source) override;
bool sync() override; bool sync() override;

View file

@ -32,7 +32,8 @@ void process_database_channels(std::shared_ptr<bot::database::database> database
for (auto channel = guild->channel.begin(); channel != guild->channel.end(); channel++) { for (auto channel = guild->channel.begin(); channel != guild->channel.end(); channel++) {
if (channel->id == *db_channel_id) { if (channel->id == *db_channel_id) {
const bot::settings::channel db_channel = database->get_channel(guild->id, channel->id); const bot::settings::channel db_channel = database->get_channel(guild->id, channel->id);
channel->source = db_channel.source; if (!db_channel.source.empty())
channel->source = db_channel.source;
for (auto db_target = db_channel.targets.begin(); db_target != db_channel.targets.end(); db_target++) { for (auto db_target = db_channel.targets.begin(); db_target != db_channel.targets.end(); db_target++) {
bool target_found = false; bool target_found = false;
for (auto target = channel->targets.begin(); target != channel->targets.end(); target++) { for (auto target = channel->targets.begin(); target != channel->targets.end(); target++) {