TellTodo is a Python and a FaunaDB powered telegram bot which helps you to manage your daily task with the help of Todo-List, you can ask TellTodo to perform the following operations:
- Add/Create your daily task in the todo list
- Check your status of the task weither it is completed or not
- Update your todo list task status to completed.
- List your Todo List
- Delete your Todo list/Task
TellTodo uses Python 3.8 Programing Language and one of the Latest and a Serverless Database which is FaunaDB.
Fauna is a Serverless Database, a serverless database is one where all maintenance and operational responsibility is outside of a developer or application’s concern, and all traffic/CRUD is accommodated with on-demand scaling. This reduces the load and effort put into managing the database resources, especially when the application begins to scale to support a large number of users.
There are a lot of advantages of picking a serverless database for your application aside from reducing work in managing database resources. They include:
- Database operational cost reduction
- Real-time database access
- Increase in productivity (since the burden of database management is removed)
- Infinite scalability
- Improved database security
we now know Fauna is a serverless database, but how does it store and handle data? At its core, Fauna is a document database that offers two interfaces, GraphQL and the Fauna Query Language (FQL). Databases can store collections, indexes, and even other databases (yay multi-tenancy!). Within collections are documents, which by default, don’t have strict schema requirements. Fauna is capable of handling a variety of data types (e.g. temporal) but is particularly impressive for having first-class support for relational data. We’ll be exploring most of this together momentarily, but if you’re eager to learn even more, check out the Fauna documentation!
Setup FaunaDB:
-
Create the account on FaunaDB
-
Click on
New Database
- After creating a Database, Click on
Collections
thenNew Collection
Give the name to the collection as users
as users name is default with our bot.
-
Similarly, create another new collection named as
todo
as todo is default with our bot. -
Now, move to
Index
and create aNew Index
and make sure that the Source Collection isusers
and Terms isdata.id
with a Nameusers
. -
Similarly create
New Index
Source Collection istodo
and Terms isdata.user_id
with a Nametodo
After a sucessfull setup your Index and collection will look like:
After setting up the whole database, now you need to get the Security Key
so go to the Security
section and get your Security Key
.
Now, your FaunaDB is setup and ready to use!!
- Ping @BotFather on Telegram.
- Send the message /start
- Read the instructions and make a new bot for your personal testing by /newbot command.
- Give a suitable name and username to the bot.
- You’ll get your bot API token as 89xxxxxxx:xxxxxxxxxxxxAAHmf32ZghS-cqxBLfnkUx9VwoXeOIRlnUQ.
- Replace and add your telegram_token_key = "YOUR_TELEGRAM_KEY" in
config.py
file. - Replace and add your fauna_secret = "your_fauna_secert" in
config.py
file.
- Install all dependencies using
pip install -r requirements.txt
- Run your bot using
python3 bot.py or python bot.py
- Ping your bot at @<username_set>. You’ll find the bot up and running.
The bot accepts the following commands:
/start
: To start the bot/add_todo
: To add todo or task/list_todo
: To list the todo or task with status
You can add as many task or todo you want!!
For executing the bot first time you need to drop a /start
cmd so that your entry will be done in the faunadb,after that you can proceed other cmd's of adding , deleting,updating and listing todo's.
You can see your queries and lastcmd's in faunadb dashboard in JSON formats, you can even query the database using String,Number or FQL.
Ping our existing 24 * 7 Active bot using @faunadbtest in telegram (for testing purpose only)!!