This repository contains the source code of the telegram bots developed and used by the COPS Dev Group.
git clone https://github.com/COPS-IITBHU/telegram-bots.git
cd telegram-bots
- Follow instructions on this page to create a new bot and obtain a token.
npm install -ci
- Add your bot token to the
nodemon.json
file. - CHATID and PASSWORD aren't necessary and are needed for deployment purpose only.
npm run lucy-bot
npm i -g vercel
vercel --prod
- Set an env variable with key
LUCY_BOT_TOKEN
equal to your bot token.
NOTE - You may need to deploy your bot again after setting the env variables.
You need to setup webhooks so that every update could be sent to that url as a post request. You can do that by this query.
https://api.telegram.org/bot"BOT_TOKEN"/setWebhook?url="DEPLOYED_URL"
- Replace the "BOT_TOKEN" (Including the quotes) with the TOKEN of your bot.
- Replace the "DEPLOYED_URL" (Including the quotes) with the production url of your serverless function. If you followed the instructions above correctly, It would look something like ->
https://telegram-bots-khaki.vercel.app/api/lucy-bot.ts
.
NOTE - If you have executed the command npm run lucy-bot
after deploying you'll need to set the webhooks again.