diff --git a/.gitignore b/.gitignore
index e9b86b7..175e8d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,14 +1,14 @@
# VS files
/.vs/
-/TriviaBot.sln
-/TriviaBot.VC*
-/TriviaBot/TriviaBot.vcxproj*
-/TriviaBot/x64/
+/Toast.sln
+/Toast.VC*
+/Toast/Toast.vcxproj*
+/Toast/x64/
/x64/
# Data files
-/TriviaBot/data_management/questions
-/TriviaBot/bot/db/trivia.db
+/Toast/data_management/questions
+/Toast/bot/db/trivia.db
# Config file
config.json
diff --git a/README.md b/README.md
index fc17243..635a60e 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-#trivia-bot
+# Toast
A bot which provides a Trivia game for [Discord](https://discordapp.com/).
@@ -16,7 +16,7 @@ If you want to install a version for which a release does not exist, you will al
### Running
-To run simply execute the program: `./TriviaBot`
+To run simply execute the program: `./Toast`
#### Configuration
The config file is automatically generated if it is not present. The JSON format is used. You must edit the config file for the bot to work correctly, the bot token is required.
@@ -53,8 +53,9 @@ LoadDB.cpp takes some time to execute.
#### Javascript Commands
The Javascript system is designed to mirror the old [Boobot implementation](https://www.boobot.party/). For now there are some exceptions:
+
1. Message objects aren't implemented.
-2. Properties are not case sensitive. You must use `server.Name`, not `server.name`. This will not be changed.
+2. Properties *are* case sensitive. You must use `server.Name`, not `server.name`. This will not be changed.
### Compiling
#### Dependencies
@@ -70,11 +71,11 @@ The Javascript system is designed to mirror the old [Boobot implementation](http
#### Linux (Debian)
c++14 support is required. gcc 5 and above recommended, however it compiles on 4.9.2 (and possibly some versions below.)
-1. Clone the github repo: `git clone https://github.com/jackb-p/TriviaDiscord.git TriviaDiscord`
-2. Navigate to repository directory: `cd TriviaDiscord`
+1. Clone the github repo: `git clone https://github.com/jackb-p/Toast.git ToastBot`
+2. Navigate to repository directory: `cd ToastBot`
3. Clone the submodules: `git submodule init` and `git submodule update`
4. Install other dependencies: `sudo apt-get install build-essential cmake libboost-all-dev libcurl4-openssl-dev libssl-dev` (Package managers and names may vary, but all of these should be easy to find through a simple Google search.) V8 may require other dependencies.
5. Build V8. Put the library files into lib/v8/lib/ and the include files into lib/v8/include. More instructions will be added at some point for this step.
-6. `cd TriviaBot`
+6. `cd Toast`
7. `cmake .`
8. `make`
diff --git a/TriviaBot/CMakeLists.txt b/Toast/CMakeLists.txt
similarity index 94%
rename from TriviaBot/CMakeLists.txt
rename to Toast/CMakeLists.txt
index 00b718f..676fb56 100644
--- a/TriviaBot/CMakeLists.txt
+++ b/Toast/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.8.7)
-project(TriviaBot)
+project(Toast)
###############################################################################
## get source ## ##############################################################
@@ -14,7 +14,7 @@ link_directories(../lib/v8/lib)
###############################################################################
# add the data to the target, so it becomes visible in some IDE
-add_executable(TriviaBot ${sources})
+add_executable(Toast ${sources})
# add some compiler flags
set (CMAKE_CXX_FLAGS "-std=c++14 -Wall ${CMAKE_CXX_FLAGS}")
@@ -27,7 +27,7 @@ find_package(Boost COMPONENTS system thread regex REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(CURL REQUIRED)
-target_link_libraries(TriviaBot PUBLIC
+target_link_libraries(Toast PUBLIC
${Boost_LIBRARIES}
${OPENSSL_LIBRARIES}
${CURL_LIBRARIES}
diff --git a/TriviaBot/bot/BotConfig.cpp b/Toast/bot/BotConfig.cpp
similarity index 100%
rename from TriviaBot/bot/BotConfig.cpp
rename to Toast/bot/BotConfig.cpp
diff --git a/TriviaBot/bot/BotConfig.hpp b/Toast/bot/BotConfig.hpp
similarity index 100%
rename from TriviaBot/bot/BotConfig.hpp
rename to Toast/bot/BotConfig.hpp
diff --git a/TriviaBot/bot/ClientConnection.cpp b/Toast/bot/ClientConnection.cpp
similarity index 100%
rename from TriviaBot/bot/ClientConnection.cpp
rename to Toast/bot/ClientConnection.cpp
diff --git a/TriviaBot/bot/ClientConnection.hpp b/Toast/bot/ClientConnection.hpp
similarity index 100%
rename from TriviaBot/bot/ClientConnection.hpp
rename to Toast/bot/ClientConnection.hpp
diff --git a/TriviaBot/bot/DiscordAPI.cpp b/Toast/bot/DiscordAPI.cpp
similarity index 100%
rename from TriviaBot/bot/DiscordAPI.cpp
rename to Toast/bot/DiscordAPI.cpp
diff --git a/TriviaBot/bot/DiscordAPI.hpp b/Toast/bot/DiscordAPI.hpp
similarity index 100%
rename from TriviaBot/bot/DiscordAPI.hpp
rename to Toast/bot/DiscordAPI.hpp
diff --git a/TriviaBot/bot/GatewayHandler.cpp b/Toast/bot/GatewayHandler.cpp
similarity index 100%
rename from TriviaBot/bot/GatewayHandler.cpp
rename to Toast/bot/GatewayHandler.cpp
diff --git a/TriviaBot/bot/GatewayHandler.hpp b/Toast/bot/GatewayHandler.hpp
similarity index 100%
rename from TriviaBot/bot/GatewayHandler.hpp
rename to Toast/bot/GatewayHandler.hpp
diff --git a/TriviaBot/bot/Logger.cpp b/Toast/bot/Logger.cpp
similarity index 100%
rename from TriviaBot/bot/Logger.cpp
rename to Toast/bot/Logger.cpp
diff --git a/TriviaBot/bot/Logger.hpp b/Toast/bot/Logger.hpp
similarity index 100%
rename from TriviaBot/bot/Logger.hpp
rename to Toast/bot/Logger.hpp
diff --git a/TriviaBot/bot/TriviaBot.cpp b/Toast/bot/Toast.cpp
similarity index 100%
rename from TriviaBot/bot/TriviaBot.cpp
rename to Toast/bot/Toast.cpp
diff --git a/TriviaBot/bot/TriviaGame.cpp b/Toast/bot/TriviaGame.cpp
similarity index 100%
rename from TriviaBot/bot/TriviaGame.cpp
rename to Toast/bot/TriviaGame.cpp
diff --git a/TriviaBot/bot/TriviaGame.hpp b/Toast/bot/TriviaGame.hpp
similarity index 100%
rename from TriviaBot/bot/TriviaGame.hpp
rename to Toast/bot/TriviaGame.hpp
diff --git a/TriviaBot/bot/data_structures/Channel.hpp b/Toast/bot/data_structures/Channel.hpp
similarity index 100%
rename from TriviaBot/bot/data_structures/Channel.hpp
rename to Toast/bot/data_structures/Channel.hpp
diff --git a/TriviaBot/bot/data_structures/Guild.hpp b/Toast/bot/data_structures/Guild.hpp
similarity index 100%
rename from TriviaBot/bot/data_structures/Guild.hpp
rename to Toast/bot/data_structures/Guild.hpp
diff --git a/TriviaBot/bot/data_structures/GuildMember.hpp b/Toast/bot/data_structures/GuildMember.hpp
similarity index 100%
rename from TriviaBot/bot/data_structures/GuildMember.hpp
rename to Toast/bot/data_structures/GuildMember.hpp
diff --git a/TriviaBot/bot/data_structures/Role.hpp b/Toast/bot/data_structures/Role.hpp
similarity index 100%
rename from TriviaBot/bot/data_structures/Role.hpp
rename to Toast/bot/data_structures/Role.hpp
diff --git a/TriviaBot/bot/data_structures/User.hpp b/Toast/bot/data_structures/User.hpp
similarity index 100%
rename from TriviaBot/bot/data_structures/User.hpp
rename to Toast/bot/data_structures/User.hpp
diff --git a/TriviaBot/bot/db/schema.sqlite b/Toast/bot/db/schema.sqlite
similarity index 100%
rename from TriviaBot/bot/db/schema.sqlite
rename to Toast/bot/db/schema.sqlite
diff --git a/TriviaBot/bot/http/DiscordCA.crt b/Toast/bot/http/DiscordCA.crt
similarity index 100%
rename from TriviaBot/bot/http/DiscordCA.crt
rename to Toast/bot/http/DiscordCA.crt
diff --git a/TriviaBot/bot/http/HTTP.cpp b/Toast/bot/http/HTTP.cpp
similarity index 100%
rename from TriviaBot/bot/http/HTTP.cpp
rename to Toast/bot/http/HTTP.cpp
diff --git a/TriviaBot/bot/http/HTTP.hpp b/Toast/bot/http/HTTP.hpp
similarity index 100%
rename from TriviaBot/bot/http/HTTP.hpp
rename to Toast/bot/http/HTTP.hpp
diff --git a/TriviaBot/bot/js/CommandHelper.cpp b/Toast/bot/js/CommandHelper.cpp
similarity index 100%
rename from TriviaBot/bot/js/CommandHelper.cpp
rename to Toast/bot/js/CommandHelper.cpp
diff --git a/TriviaBot/bot/js/CommandHelper.hpp b/Toast/bot/js/CommandHelper.hpp
similarity index 100%
rename from TriviaBot/bot/js/CommandHelper.hpp
rename to Toast/bot/js/CommandHelper.hpp
diff --git a/TriviaBot/bot/js/V8Instance.cpp b/Toast/bot/js/V8Instance.cpp
similarity index 100%
rename from TriviaBot/bot/js/V8Instance.cpp
rename to Toast/bot/js/V8Instance.cpp
diff --git a/TriviaBot/bot/js/V8Instance.hpp b/Toast/bot/js/V8Instance.hpp
similarity index 100%
rename from TriviaBot/bot/js/V8Instance.hpp
rename to Toast/bot/js/V8Instance.hpp
diff --git a/TriviaBot/bot/json/LICENSE.MIT b/Toast/bot/json/LICENSE.MIT
similarity index 100%
rename from TriviaBot/bot/json/LICENSE.MIT
rename to Toast/bot/json/LICENSE.MIT
diff --git a/TriviaBot/bot/json/json.hpp b/Toast/bot/json/json.hpp
similarity index 100%
rename from TriviaBot/bot/json/json.hpp
rename to Toast/bot/json/json.hpp
diff --git a/TriviaBot/data_management/LoadDB.cpp b/Toast/data_management/LoadDB.cpp
similarity index 100%
rename from TriviaBot/data_management/LoadDB.cpp
rename to Toast/data_management/LoadDB.cpp
diff --git a/TriviaBot/bot/TriviaBot.cpp.save b/TriviaBot/bot/TriviaBot.cpp.save
deleted file mode 100644
index 5ebbefd..0000000
--- a/TriviaBot/bot/TriviaBot.cpp.save
+++ /dev/null
@@ -1,64 +0,0 @@
-#include
-#include
-#include
-
-#include "ClientConnection.hpp"
-#include "Logger.hpp"
-#include "DiscordAPI.hpp"
-
-std::string bot_token;
-
-int main(int argc, char *argv[]) {
- curl_global_init(CURL_GLOBAL_DEFAULT);
-
- v8::V8::InitializeICUDefaultLocation(argv[0]);
- v8::V8::InitializeExternalStartupData(argv[0]);
- v8::Platform* platform = v8::platform::CreateDefaultPlatform();
- v8::V8::InitializePlatform(platform);
- v8::V8::Initialize();
-
- Logger::write("Initialised V8 and curl", Logger::LogLevel::Debug);
-
- if (argc == 2) {
- bot_token = argv[1];
- }
- else {
- std::cout << "Please enter your bot token: " << std::endl;
- std::cin >> bot_token;
- }
-
- std::string args = "/?v=5&encoding=json";
- std::string url = DiscordAPI::get_gateway().value("url", "wss://gateway.discord.gg");
-
- bool retry = true;
- while (retry) {
- try {
- ClientConnection conn;
- conn.start(url + args);
- }
- catch (const std::exception &e) {
- Logger::write("std exception: " + std::string(e.what()), Logger::LogLevel::Severe);
- retry = false;
- }
- catch (websocketpp::lib::error_code e) {
- Logger::write("websocketpp exception: " + e.message(), Logger::LogLevel::Severe);
- }
- catch (...) {
- Logger::write("other exception.", Logger::LogLevel::Severe);
- retry = false;
- }
- }
-
- v8::V8::Dispose();
- v8::V8::ShutdownPlatform();
- delete platform;
-
- curl_global_cleanup();
-
- Logger::write("Cleaned up", Logger::LogLevel::Info);
-
- std::cout << "Press enter to exit" << std::endl;
- std::getchar();
-
- return 0;
-}