diff --git a/CMakeLists.txt b/CMakeLists.txt index 189f42b..dbfd39f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ include(GNUInstallDirs) # dtranslatebot Source files set(DTRANSLATEBOT_HEADERS + src/database_core.h src/message_queue.h src/settings.h src/slashcommands.h @@ -31,6 +32,7 @@ set(DTRANSLATEBOT_HEADERS src/webhook_push.h ) set(DTRANSLATEBOT_SOURCES + src/database_core.cpp src/main.cpp src/message_queue.cpp src/settings.cpp diff --git a/src/database_core.cpp b/src/database_core.cpp new file mode 100644 index 0000000..8c66c8b --- /dev/null +++ b/src/database_core.cpp @@ -0,0 +1,87 @@ +/***************************************************************************** +* dtranslatebot Discord Translate Bot +* Copyright (C) 2024 Syping +* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* This software is provided as-is, no warranties are given to you, we are not +* responsible for anything with use of the software, you are self responsible. +*****************************************************************************/ + +#ifndef NDEBUG +#include +#endif +#include "database_core.h" +using namespace bot::database; + +database::database() +{ +} + +database::~database() +{ +} + +bool database::add_channel_target(dpp::snowflake guild_id, dpp::snowflake channel_id, const bot::settings::target &target) +{ +#ifndef NDEBUG + std::cerr << "[Debug] database::add_channel_target(dpp::snowflake, dpp::snowflake, const bot::settings::target&) have being called." << std::endl; +#endif + return false; +} + +std::variant database::find_channel_target(dpp::snowflake guild_id, dpp::snowflake channel_id, const std::string &target) +{ +#ifndef NDEBUG + std::cerr << "[Debug] database::find_channel_target(dpp::snowflake, dpp::snowflake, const std::string&) have being called." << std::endl; +#endif + return {}; +} + +std::vector database::get_channels(dpp::snowflake guild_id) +{ +#ifndef NDEBUG + std::cerr << "[Debug] database::get_channels(dpp::snowflake) have being called." << std::endl; +#endif + return {}; +} + +std::string database::get_channel_source(dpp::snowflake guild_id, dpp::snowflake channel_id) +{ +#ifndef NDEBUG + std::cerr << "[Debug] database::get_channel_source(dpp::snowflake, dpp::snowflake) have being called." << std::endl; +#endif + return {}; +} + +std::vector database::get_channel_targets(dpp::snowflake guild_id, dpp::snowflake channel_id) +{ +#ifndef NDEBUG + std::cerr << "[Debug] database::get_channel_targets(dpp::snowflake, dpp::snowflake) have being called." << std::endl; +#endif + return {}; +} + +std::vector database::get_guilds() +{ +#ifndef NDEBUG + std::cerr << "[Debug] database::get_guilds() have being called." << std::endl; +#endif + return {}; +} + +bool database::set_channel_source(dpp::snowflake guild_id, dpp::snowflake channel_id, const std::string &source) +{ +#ifndef NDEBUG + std::cerr << "[Debug] database::set_channel_source(dpp::snowflake, dpp::snowflake, const std::string&) have being called." << std::endl; +#endif + return false; +} diff --git a/src/database_core.h b/src/database_core.h new file mode 100644 index 0000000..e47724e --- /dev/null +++ b/src/database_core.h @@ -0,0 +1,42 @@ +/***************************************************************************** +* dtranslatebot Discord Translate Bot +* Copyright (C) 2024 Syping +* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* This software is provided as-is, no warranties are given to you, we are not +* responsible for anything with use of the software, you are self responsible. +*****************************************************************************/ + +#ifndef DATABASE_CORE_H +#define DATABASE_CORE_H + +#include +#include "settings.h" + +namespace bot { + namespace database { + class database { + public: + explicit database(); + virtual ~database(); + virtual bool add_channel_target(dpp::snowflake guild_id, dpp::snowflake channel_id, const bot::settings::target &target); + virtual std::variant find_channel_target(dpp::snowflake guild_id, dpp::snowflake channel_id, const std::string &target); + virtual std::vector get_channels(dpp::snowflake guild_id); + virtual std::string get_channel_source(dpp::snowflake guild_id, dpp::snowflake channel_id); + virtual std::vector get_channel_targets(dpp::snowflake guild_id, dpp::snowflake channel_id); + virtual std::vector get_guilds(); + virtual bool set_channel_source(dpp::snowflake guild_id, dpp::snowflake channel_id, const std::string &source); + }; + } +} + +#endif // DATABASE_CORE_H