a simple c++17 library for stoat.chat.
- c++17 compiler
- cmake (3.16+)
- git
- openssl
add it as a subdirectory in your cmake project:
git clone https://codeberg.org/siq/stoatplusplus.git stoatppthen add to your CMakeLists.txt:
add_subdirectory(stoatpp)
target_link_libraries(your_target PRIVATE stoatpp)open the ucrt64 or mingw64 shell (do not use the msys shell) and run:
# for ucrt64
pacman -S git mingw-w64-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-openssl
# for mingw64
pacman -S git mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-opensslbuild locally:
mkdir build && cd build
cmake -G "MinGW Makefiles" ..
cmake --build .sudo apt update
sudo apt install build-essential cmake git libssl-dev
mkdir build && cd build
cmake ..
cmake --build .since the host system is read-only, use distrobox (pre-installed) to create a development container:
# create and enter a fedora container
distrobox create -n dev-box -i registry.fedoraproject.org/fedora:40
distrobox enter dev-box
# inside the container, install dependencies
sudo dnf install git cmake gcc-c++ openssl-devel
# build
mkdir build && cd build
cmake ..
cmake --build .#include <stoatpp/stoatpp.h>
#include <iostream>
int main() {
stoatpp::ClientConfig cfg;
cfg.log_level = stoatpp::LogLevel::INFO;
stoatpp::cluster bot("YOUR_BOT_TOKEN_HERE", cfg);
bot.on_ready([](const stoatpp::events::Ready& event) {
std::cout << "logged in as " << event.user.username << "\n";
});
bot.on_message([&bot](const stoatpp::events::Message& event) {
if (event.author.bot) return;
if (event.content == "!ping") {
bot.send_message(event.channel_id, "pong!");
}
});
bot.start();
return 0;
}see docs.md for the full api.
join the server.