Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Commit

Permalink
Merge pull request #23 from zeroxs/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
zeroxs authored Oct 24, 2019
2 parents e4e1fbc + 30978e2 commit 176c67b
Show file tree
Hide file tree
Showing 23 changed files with 487 additions and 151 deletions.
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ message(STATUS "CMake version: ${CMAKE_VERSION}")

cmake_minimum_required(VERSION 3.8)

file(READ ${CMAKE_SOURCE_DIR}/include/aegis/version.hpp version_hpp)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/include/aegis/version.hpp version_hpp)
if (NOT version_hpp MATCHES "AEGIS_VERSION_SHORT ([0-9][0-9])([0-9][0-9])([0-9][0-9])")
message(FATAL_ERROR "Cannot get AEGIS_VERSION_SHORT from version.hpp. ${CMAKE_SOURCE_DIR}/include/aegis/version.hpp")
message(FATAL_ERROR "Cannot get AEGIS_VERSION_SHORT from version.hpp. ${CMAKE_CURRENT_SOURCE_DIR}/include/aegis/version.hpp")
endif ()
math(EXPR AEGIS_VERSION_MAJOR ${CMAKE_MATCH_1})
math(EXPR AEGIS_VERSION_MINOR ${CMAKE_MATCH_2})
Expand All @@ -26,7 +26,7 @@ endif()

project(libaegis VERSION ${AEGIS_VERSION} LANGUAGES CXX)

list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake)
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
Expand All @@ -43,9 +43,9 @@ set(REQUIRED_LIBS OpenSSL::SSL ZLIB::ZLIB Spdlog::Spdlog JSON::JSON Asio::Asio d
option(BUILD_SHARED_LIBS "Build the shared library" ON)
option(BUILD_EXAMPLES "Build example programs" OFF)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_BUILD_TYPE Release)

set(AEGIS_FILES
Expand Down Expand Up @@ -150,7 +150,7 @@ if (BUILD_SHARED_LIBS)
)

CONFIGURE_FILE(
"${CMAKE_SOURCE_DIR}/cmake/aegis.pc.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/aegis.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/aegis.pc"
)

Expand Down Expand Up @@ -195,7 +195,7 @@ else ()
)

CONFIGURE_FILE(
"${CMAKE_SOURCE_DIR}/cmake/aegis_static.pc.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/aegis_static.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/aegis.pc"
)

Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Including the helper header will automatically include all other files.

int main()
{
aegis::core bot;
aegis::core bot(aegis::create_bot_t().log_level(spdlog::level::trace).token("TOKEN"));
bot.set_on_message_create([](auto obj)
{
if (obj.msg.get_content() == "Hi")
Expand Down Expand Up @@ -112,3 +112,8 @@ You can change basic configuration options within the `config.json` file. It sho
"log-format": "%^%Y-%m-%d %H:%M:%S.%e [%L] [th#%t]%$ : %v"
}
```

Alternatively you can configure the library by passing in the [create_bot_t()](https://docs.aegisbot.io/structaegis_1_1create__bot__t.html) object to the constructor of the aegis::core object. You can make use of it fluent-style.
```cpp
aegis::core(aegis::create_bot_t().log_level(spdlog::level::trace).token("TOKEN"))
```
6 changes: 3 additions & 3 deletions aegis.dox
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ using json = nlohmann::json;
int main(int argc, char * argv[])
{
// Create bot object with a minimum log level of trace
aegis::core bot(aegis::create_bot_t().log_level(spdlog::level::info).token("TOKEN"));
aegis::core bot(aegis::create_bot_t().log_level(spdlog::level::trace).token("TOKEN"));

AEGIS_TRACE(bot.log, "Bot object created");

Expand Down Expand Up @@ -76,7 +76,7 @@ void message_create(aegis::gateway::events::message_create obj)
int main(int argc, char * argv[])
{
// Create bot object with a minimum log level of trace
aegis::core bot(aegis::create_bot_t().log_level(spdlog::level::info).token("TOKEN"));
aegis::core bot(aegis::create_bot_t().log_level(spdlog::level::trace).token("TOKEN"));

AEGIS_TRACE(bot.log, "Bot object created");

Expand Down Expand Up @@ -125,7 +125,7 @@ public:
int main(int argc, char * argv[])
{
// Create bot object with a minimum log level of trace
aegis::core bot(aegis::create_bot_t().log_level(spdlog::level::info).token("TOKEN"));
aegis::core bot(aegis::create_bot_t().log_level(spdlog::level::trace).token("TOKEN"));

my_bot my_bot_instance;

Expand Down
2 changes: 1 addition & 1 deletion cmake/FindAsio.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ find_path(Asio_INCLUDE_DIR

if (Asio_INCLUDE_DIR STREQUAL "Asio_INCLUDE_DIR-NOTFOUND")
message(WARNING "Using git-module path for Asio")
set(Asio_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/lib/asio/asio/include/)
set(Asio_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/asio/asio/include/)
endif ()

file(READ ${Asio_INCLUDE_DIR}/asio/version.hpp version_hpp)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindJSON.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ find_path(JSON_INCLUDE_DIR

if (JSON_INCLUDE_DIR STREQUAL "JSON_INCLUDE_DIR-NOTFOUND")
message(WARNING "Using git-module path for JSON")
set(JSON_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/lib/json/include)
set(JSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/json/include)
set(JSON_SUBDIR true)
endif ()

Expand Down
2 changes: 1 addition & 1 deletion cmake/FindSpdlog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ find_path(Spdlog_INCLUDE_DIR

if (Spdlog_INCLUDE_DIR STREQUAL "Spdlog_INCLUDE_DIR-NOTFOUND")
message(WARNING "Using git-module path for Spdlog")
set(Spdlog_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/lib/spdlog/include/)
set(Spdlog_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/spdlog/include/)
endif ()

file(READ ${Spdlog_INCLUDE_DIR}/spdlog/common.h common_h)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindWebsocketpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ find_path(Websocketpp_INCLUDE_DIR

if (Websocketpp_INCLUDE_DIR STREQUAL "Websocketpp_INCLUDE_DIR-NOTFOUND")
message(WARNING "Using git-module path for Websocketpp")
set(Websocketpp_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/lib/websocketpp/)
set(Websocketpp_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/websocketpp/)
endif ()

file(READ ${Websocketpp_INCLUDE_DIR}/websocketpp/version.hpp version_hpp)
Expand Down
Loading

0 comments on commit 176c67b

Please sign in to comment.