MrWolfa

A Telegram Bot made in Node.js that can answer questions asked by users, covering many topics such as mathematics, physics, history, culture, nutrition and many more.

Answer computing leverages the power of Wolfram|Alpha computational knowledge engine API.

It can provide answers either by text or vocal message thanks to Google Cloud Text-to-Speech API.


Source code Bot
Image
Works in private chat
Image
Can answer with a vocal message
Image
Filters non-english questions
Image
Works as an inline-bot
Image
Simple math handled by Math.js
Image
Wolfram|Alpha for longer ones

What I did

  • Used Telegraf.js framework to interact with the Telegram Bot API and develop a bot with a custom command system that works both in private chats and as an inline-bot
  • Used the wolfram-alpha-api library to fetch questions and get answers from Wolfram|Alpha
  • Used the Node.js client for Google Cloud Text-to-Speech API to synthesize answers from Wolfram|Alpha and send them as vocal messages
  • Used languagedetect module to implement a language filter that detects non-english questions and avoids wasting api calls
  • Used Math.js to handle simple math questions and avoid wasting api calls
  • Used Object Oriented programming, specifically a combination of the Template method pattern and the Strategy pattern to implement the decision tree the bot uses to answer questions
  • Used Git and Heroku Pipelines to implement a simple continuous delivery workflow and handle bot releases