Skip to content

boolfalse/simple-question-complex-answer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Simple Question => A Complex Answer


A Telegram bot that answers your questions with a voice message.

sqca

A Simple Question => A Complex Answer

Prerequisites:

Installation:

  • Create a new AWS IAM user, give it access to Polly.

  • Create a new Telegram bot with @BotFather.

  • Create a new Telegram channel and add the bot as an admin.

  • Create a new MongoDB Atlas cluster and set up IP whitelist.

  • Have a Google Bard account. In a browser open inspect element. __Secure-1PSID, __Secure-1PSIDTS cookie values from Application -> Cookies -> https://accounts.google.com

  • Clone the repo and install dependencies:

git clone git@github.com:boolfalse/simple-question-complex-answer.git && cd simple-question-complex-answer/ npm install
  • Install python dependencies (you may use pip3 instead of pip for your case):
pip install SpeechRecognition pip install bardapi pip install --upgrade GoogleBard
  • Create a .env file in the root directory of the project and add the following:
# @BotFather token here TELEGRAM_BOT_TOKEN="" # Usually it's "python3" or kind of "/usr/local/bin/python3.10" PYTHON_EXEC_PATH="python3" # Copy values and add it here respectively GOOGLE_BARD_SECURE_1PSID="" GOOGLE_BARD_SECURE_1PSIDTS="" # AWS IAM user keys AWS_ACCESS_KEY="" AWS_SECRET_KEY="" # MongoDB Atlas connection string MONGODB_URI="mongodb+srv://<USER>:<PASSWORD>@cluster0.mzcsh.mongodb.net/<DB_NAME>?retryWrites=true&w=majority"
  • Run the app:
    • Development:
    npm run dev
    • Production:
    npm run start
    • Command samples on production:
    # start forever start -c "npm run start" ./ # list forever list # stop forever stop <pid>

TODOs:

  • Add used resources to the "Resources" section
  • Refactor codebase (middlewares)
  • Logging/error-handling (file writing, Slack/Telegram notification)
  • Modify DB for multiple sessions
  • Add "/new" command with session management
  • Add command to leave chat
  • Add invitation functionality
  • Add usage limit to non-invited users
  • Queue messages to avoid any 3rd party APIs limitations
  • Use messaging system (e.g. Kafka, RabbitMQ)

Resources:

Author:

About

A Telegram bot that answers your questions with a voice message

Topics

Resources

Stars

Watchers

Forks