This repository is just a small project in my free time. You can clone this repo and use it as you liked ;).
first you should open this link https://t.me/botfather, then you will see this chat room.
After that use /newbot
then insert your bot name then add username for the bot it should end with bot. so for the example is Testbotforgithub_bot
. Foila you've made your own bot. Please secure and store your HTTP API Token
.
to clone project open terminal or CMD and type git clone https://github.com/adrianwijaya584/telegram-bot-ts.git --branch=master folder_name
you can add folder_name as you liked. ex: telebots.
After cloning the project you will see
you need nodemon npm i -g nodemon
If you want to use pm2 for production you should install pm2 in your server or pc first using npm i -g pm2
. Then you will see pm2.config.json
file.
Typescript can't run plainly on node js so we have to build it into js file so type npm run build
and you will see build folder generated in the project.
Then type pm2 start pm2.config.json
in your terminal/cmd. The prod with pm2 is finished.
You can use pm2 save
for saving current process list so if your server is down you just have to use pm2 resurrect
to bring back process so you don't have to search pm2 configuration one by one.
to restart or reload you can use pm2 restart
or pm2 reload
you can read the differnce here !
coming soon for docker configuration