68 lines
2.1 KiB
Markdown
68 lines
2.1 KiB
Markdown
# 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
|
|
|
|
### Ubuntu 24.04 LTS
|
|
|
|
```
|
|
sudo apt update
|
|
sudo apt upgrade -y
|
|
sudo apt install build-essential curl git cmake zlib1g-dev libssl-dev -y
|
|
mkdir workdir
|
|
cd workdir
|
|
git clone https://github.com/brainboxdotcc/DPP.git
|
|
cd DPP
|
|
cmake -B ./build
|
|
cmake --build ./build -j8
|
|
cd ..
|
|
git clone https://git.indoodle.com/oomer/poomer-discord.git
|
|
cd poomer-discord
|
|
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 -j4
|
|
```
|
|
|
|
|
|
### MacOS
|
|
|
|
```
|
|
mkdir workdir
|
|
cd workdir
|
|
mkdir homebrew
|
|
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip-components 1 -C homebrew
|
|
eval "$(homebrew/bin/brew shellenv)"
|
|
brew update --force --quiet
|
|
brew install openssl
|
|
git clone https://github.com/brainboxdotcc/DPP.git
|
|
cd DPP
|
|
/Applications/CMake.app/Contents/bin/cmake -B ./build \
|
|
-DOPENSSL_ROOT_DIR=../homebrew/opt/openssl@3 \
|
|
-DOPENSSL_INCLUDE_DIR=../homebrew/opt/openssl@3/include \
|
|
-DOPENSSL_CRYPTO_LIBRARY=../homebrew/opt/openssl@3/lib/libcrypto.a \
|
|
-DOPENSSL_SSL_LIBRARY=../homebrew/opt/openssl@3/lib/libssl.a
|
|
|
|
/Applications/CMake.app/Contents/bin/cmake --build ./build -j8
|
|
cd ..
|
|
git clone https://git.indoodle.com/oomer/poomer-discord.git
|
|
cd poomer-discord
|
|
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 -j4
|
|
```
|
|
|