Skip to content

Commit 8fe2c72

Browse files
committed
Initial commit.
0 parents  commit 8fe2c72

15 files changed

+11840
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

CMakeLists.txt

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
cmake_minimum_required(VERSION 3.2.2)
2+
3+
project(postbot)
4+
5+
# todo: make some Android-specific conditional statements
6+
option(USE_TO_STRING_HACK "Use the std::to_string hackish implementation on Android NDK" OFF)
7+
8+
if(MSVC)
9+
# not tested.
10+
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -O2 -EHsc")
11+
else()
12+
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -O2 -g -std=c++1y")
13+
# -Wall -Wextra -Werror -pedantic -g -std=c++1y")
14+
endif()
15+
16+
set(SOURCES
17+
"main.cpp"
18+
"bot_easy_api.cpp"
19+
"bot_network.cpp"
20+
"writefn_data.c"
21+
)
22+
23+
set(HEADERS
24+
"writefn_data.h"
25+
"termcolor.h"
26+
"bot_easy_api.h"
27+
"tgtypes.h"
28+
"json.hpp"
29+
)
30+
31+
if(USE_TO_STRING_HACK)
32+
set(HEADERS
33+
${HEADERS}
34+
"include/to_string/to_string.h"
35+
)
36+
add_definitions("-DUSE_TO_STRING_HACK")
37+
endif()
38+
39+
find_package(CURL REQUIRED)
40+
add_executable(rcnbot ${SOURCES} ${HEADERS})
41+
target_link_libraries(rcnbot curl)

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Channel Post helper bot
2+
3+
## Configuration
4+
5+
* Fill in the ./cfg/channelid and the ./cfg/channelname for the bot, or else it can't help you with posting;
6+
* Get a token from the @BotFather bot and fill in the file botkey.h;
7+
* Build bot via ./build.sh (or directly run the cmake in output directory with arguments;
8+
* Run in shell / cron / .sh-script / etc.
9+
* Have fun!
10+
11+
## Dependencies
12+
* C++11;
13+
* cmake;
14+
* curl;
15+
* nlohmann json (file json.hpp);
16+
* to\_string workaround for Android NDK. You may disable it while configuring the cmake build.

0 commit comments

Comments
 (0)