poomer-discord
Overview
Prototype C++ Discord bot, that supports 2 features
- listens for /oomer command and replies, then 5 seconds later it sends a jpeg
- When one or more jpegs are dropped into a channel, it will read the jpeg, flip it vertically and send it back to the channel
- In both cases it will use @{user} in the reponse to notify the submitter
Technical details
- Uses DPP c++ lib for Discord comms
- depends on openssl and zlib
- non blocking multi-threaded, so it can listen for other users sending /oomer command while spawning one or more threads to deal with jpeg replies
- jpeg image is stored as byte data in embedded_image.h to avoid an on disk jpeg.
Build
workdir/
├── DPP/
├── libssl/
├── zlib/
├── libssl/
└── poomer-discord/
Ubuntu Linux x64 and arm64
sudo apt install build-essential git cmake -y
mkdir workdir && cd workdir
mkdir zlib libssl DPP poomer-discord sqlite3
# Build zlib
cd zlib && git clone https://github.com/madler/zlib.git .
./configure --static
make -j$(nproc)
# Build OpenSSL
cd ../libssl && git clone https://github.com/openssl/openssl.git .
./Configure $([ "$(uname -m)" = "aarch64" ] && echo "linux-aarch64" || echo "linux-x86_64")
make -j$(nproc)
# Build DPP
cd ../DPP && git clone https://github.com/brainboxdotcc/DPP.git .
#zlib wants an absolute path to help cmake find_package work, ssl requires explicit vars
cmake -B ./build -DCMAKE_PREFIX_PATH="$PWD/../zlib;$PWD/../libssl"
cmake --build ./build -j$(nproc)
# Build sqlite3
cd ../sqlite3
wget https://www.sqlite.org/2025/sqlite-autoconf-3510100.tar.gz
tar xzf sqlite-autoconf-3510100.tar.gz --strip-components=1
./configure --enable-static --disable-shared && make -j$(nproc)
cd ../poomer-discord && git clone https://git.indoodle.com/oomer/poomer-discord.git .
wget https://raw.githubusercontent.com/nothings/stb/master/stb_image.h
wget https://raw.githubusercontent.com/nothings/stb/master/stb_image_write.h
make all -j$(nproc)
MacOS x64 and arm64
mkdir workdir && cd workdir
mkdir zlib libssl DPP poomer-discord sqlite3
# Build zlib
cd zlib && git clone https://github.com/madler/zlib.git .
./configure --static
make -j$(sysctl -n hw.ncpu)
# Build OpenSSL (creates dynamic .dylib libraries needed for DPP)
cd ../libssl && git clone https://github.com/openssl/openssl.git .
./Configure $([ "$(uname -m)" = "arm64" ] && echo "darwin64-arm64-cc" || echo "darwin64-x86_64-cc")
make -j$(sysctl -n hw.ncpu)
# Fix OpenSSL library install names for portability
# Run this after OpenSSL is built to make the libraries use @rpath instead of hardcoded paths
install_name_tool -id @rpath/libssl.dylib libssl.dylib
install_name_tool -id @rpath/libcrypto.dylib libcrypto.dylib
install_name_tool -change /tmp/openssl-install/lib/libcrypto.4.dylib @rpath/libcrypto.dylib libssl.dylib
# Build sqlite3
cd ../sqlite3
curl -LO https://www.sqlite.org/2025/sqlite-autoconf-3510100.tar.gz
tar xzf sqlite-autoconf-3510100.tar.gz --strip-components=1
./configure --enable-static --disable-shared && make -j$(sysctl -n hw.ncpu)
# Build DPP
cd ../DPP && git clone https://github.com/brainboxdotcc/DPP.git .
/Applications/CMake.app/Contents/bin/cmake -B ./build \
-DOPENSSL_INCLUDE_DIR="$PWD/../libssl/include" \
-DOPENSSL_CRYPTO_LIBRARY="$PWD/../libssl/libcrypto.dylib" \
-DOPENSSL_SSL_LIBRARY="$PWD/../libssl/libssl.dylib" \
-DCMAKE_PREFIX_PATH="$PWD/../zlib"
/Applications/CMake.app/Contents/bin/cmake --build ./build -j$(sysctl -n hw.ncpu)
# Build poomer-discord
cd ../poomer-discord
git clone https://git.indoodle.com/oomer/poomer-discord.git .
curl -LO https://raw.githubusercontent.com/nothings/stb/master/stb_image.h
curl -LO https://raw.githubusercontent.com/nothings/stb/master/stb_image_write.h
make all -j$(sysctl -n hw.ncpu)
Windows x64
mkdir workdir && cd workdir
mkdir zlib libssl DPP poomer-discord sqlite3
cd ..\zlib
git clone https://github.com/madler/zlib.git .
nmake -f win32/Makefile.msc zlib.lib
cd ../libssl
# Get Perl and Build libssl
curl -LO https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/download/SP_54201_64bit/strawberry-perl-5.42.0.1-64bit-portable.zip
git clone https://github.com/openssl/openssl.git .
perl\bin\perl.exe Configure VC-WIN64A
nmake
# Build sqlite3
curl -LO https://www.sqlite.org/2025/sqlite-autoconf-3510100.tar.gz
tar xzf sqlite-autoconf-3510100.tar.gz --strip-components=1
nmake /f Makefile.msc sqlite3.exe
# Build DPP
cd ..\DPP
git clone https://github.com/brainboxdotcc/DPP.git .
cmake -B ./build -DOPENSSL_INCLUDE_DIR="$PWD/../libssl/include" -DOPENSSL_CRYPTO_LIBRARY="$PWD/../libssl/libcrypto.dylib" -DOPENSSL_SSL_LIBRARY="$PWD/../libssl/libssl.dylib" -DCMAKE_PREFIX_PATH="$PWD/../zlib"
cmake --build ./build -j4
# Build poomer-discord
cd ../poomer-discord
git clone https://git.indoodle.com/oomer/poomer-discord.git .
curl -LO https://raw.githubusercontent.com/nothings/stb/master/stb_image.h
curl -LO https://raw.githubusercontent.com/nothings/stb/master/stb_image_write.h
Languages
C
50%
C++
42.5%
Makefile
7.5%