A bot skeleton to quickly setup random posting
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Jan Kotowski 1d54fa6cf4 fix bot autostop on error 2 years ago
examples updated exmaples: 2 years ago
spec clear 2 years ago
src fix bot autostop on error 2 years ago
.dockerignore updates and fixes to Docker part 2 years ago
.gitignore updates to gitignore 2 years ago
COPYING clear 2 years ago
Dockerfile updates and fixes to Docker part 2 years ago
README.md updates to TODO list 2 years ago
README.org updates to TODO list 2 years ago
base.png updates and fixes to Docker part 2 years ago
distribution.tar fix bot autostop on error 2 years ago
flowchart.png clear 2 years ago
index.js fix bot autostop on error 2 years ago
package-lock.json updates and fixes to Docker part 2 years ago
package.json updates and fixes to Docker part 2 years ago

README.md

Table of Contents

  1. Install & run
  2. Documentation
    1. Flow chart
  3. todos:

Install & run

To install dependencies run

npm i

Push single item id to flow

BOT_TOKEN="<token>" CHANNEL_ID="<@channel_id>" node index.js %id%

To start random operation on cron (aka daemon mode)

BOT_TOKEN="<token>" CHANNEL_ID="<@channel_id>" node index.js

BOT_TOKEN is your bot's token, provided by @botfather, and CHANNEL_ID= is an id or username of corresponding telegram channel.

To build Docker container and run it:

docker build --build-arg BOT_TOKEN=%token% --build-arg CHANNEL_ID=%channel_id% -t %tag% .
docker run -d -t %tag%

Documentation

Flow chart

img

todos:

  • make pre-commit hook to generate tar distribution of only needed files for fevelopment
  • src/telegram.js:9: sendDocument
  • index.js:5: better argparse
  • index.js:25: async/await, get rid of style mix
  • spec/flow-test.js:59: test Metadata population fails
  • spec/flow-test.js:84: test Report sending fails

whishlist:

  • autoexport md file on save
  • any kind of web-interface, to poke bot via http
  • AMQP integration
  • build script to strip out unwanded libs
  • any kind of logging/saving results (done after posting)
  • debug levels and logging
  • register hooks more functional way
  • support proxy
  • migrate to golang (maybe)