Please, feel free to create PRs with suggestion & improvements of that document.
This file describes everything you need to know for writing code in a way we do it. Morever, here you'll find all basic answers how to start & develop.
We have special issue for those who want to join. We (and world) need you :)
Follow style guidelines & folder structure; stay passionate and code,
- You can contribute straight away, no need to wait - create your PR,
- Contact any collaborator for adding your to contributors list.
TODO: split this in sections
- Typescript means types whenever possible,
- prefer arrow functions,
- prefer functional type of coding,
- try to avoid side effects,
- no camel case,
Only contains platform related logic (e.g. .env file; sending messages; platform related interface adaption).
Take a look into server/bots/telegram/*
for an example.
Contains models used in application (regardless of a platform it's running (Telegram, Viber ... ))
Leave for now.
- - `/api`. Only responsible for API calls, - `/domain`. Has all domain-specific logic (data mapping, resolving), - `/utils`. Service helpers. - todo? `/`
- - `*/messages` User message representation (should not be dependent on any platform), - `utils.ts` Infrastructure helpers, - `[helperFunction].ts` Have project wide helpers (e.g. _deepCopy_, _isEqual_ etc.). If you want to create new helper function - create file `[helperFunctionName].ts` for that.
All inner folder's structure preferebly should follow structure above (fine-grained approach).
Checked, that the application works with
- Node version v10.16.0
- npm version 6.9.0
on Windows 10, x64 machine
- Open BotFather,
- Create your development version of the bot (for your local testing purpose) via
/newbot
command - Receive from BotFather Key & Copy it,
- Create
.env
in/server/src/bots/telegram
file and add received key there (more about it in README, example file), - Add to the project,
- run
npm i
- run
npm run start:watch
,npm run start:inspect
for debugging (Useful link)
Follow the official doc
- After bot creation add
API key
to the.env
. Take a look in example file for more information - run
npm i
- run
npm run start:watch
,npm run start:inspect
for debugging (Useful link)
Hints
- If you're running locally, you can run
ngrok http 3000
copyhttps url
paste toAPP_URL
env variable and reloading will be faster and cheaper for CPU
- contact any collaborator,
- or text via mail (danbilokha@gmail.com) or via Telegram (@danbilokha)
For running the application we need to have secure connection (as some all known messengers do not support running via http) thus we are using ngrok library for that, currently. It creates public domain with secured connection with we are using for redirecting all messages to our local machines.