Simple bot for greeting new people in your telegram group chat.
Important steps before using this project:
-
Create your Bot
Search in telegram @BotFather or open this link
Write the command “/newBot “
Follow all the steps Write down 2 things :- bot name (finished in ‘bot’): In example firebaseBot
- Secret Token (don’t miss it): in example LONG_STRING_TOKEN
-
Create your Firebase project
Go to your firebase console https://console.firebase.google.com
Add a new project
Write down the id of the project: in example firebase-bot-xxYYxUpgrade your plan to Blaze (pay-as-you-go, No-cost up to 2M/month invocations: it's about 70000 messages in day for your bot to handle )
Clone the project. Install globally firebase-tools: npm install -g firebase-tools Login into firebase: firebase login Init firebase in the same folder: firebase init functions Choose:
- existing project
- overwrite default
- overwrite index.ts - NO
Check .firebaserc, make sure that "default" field contains the id of your firebase project.
"default": /*add your project id firebaseBot-xxYYx */
Set environment variables with following commands:
You bot token from 1.
firebase functions:config:set telegram.token="<LONG_STRING_TOKEN>"
Url of your project, usually region+firebase project id:
firebase functions:config:set telegram.url="https://us-central1-<YOURFIREBASEPROJECTID>.cloudfunctions.net/bot"
Feel free to modify array "greetings" in index.ts to add your own funny greetings for users.
Use npm deploy
After the deployment you can test your bot with "/testme" command.