Selling_Books_Bot
Description
Say, you have a bunch of items you need no more and you want to sell it all out.
That's where you're going to have to use this telegram bot.
It provides you with the opportunity to easily sell your stuff
as well as the client with the opportunity to easily purchase it.
This particular telegram bot is is written to sell some of my books.
How does it work exactly?
Initial data
In "data" folder there are three files named "arab", "history", and "the_world" representing three areas, which the books are dedicated to. Each of the files comprises several books represented as instances of class Item. The description of each book is inserted into Postgresql DB table "books" as well.
The Beginning
On "/start" command the bot suggests a client three buttons epitomizing the areas where the latter may pick up a book from.
The Choosing
After pressing "Area button" the client receives a number of books on the topic and chooses one.
The client receives only the books that are not sold out at this point,
i.e. the bot requests the DB whether "units_in_stock" for this particular item are more than zero.
In case of having no books on the topic the bot asks the client to choose a book from another area.
First case | Second case |
---|---|
The Payment
Right after filling out the address and choosing the shipping option the client carries out the payment through embedded Tranzzo payment solution and gets a receipt.
Address | Shipping_opt | Payment |
---|---|---|
The Notification
As soon as the payment from the client is received, the owners of the bot are notified of the details of the new order in a special message. Simultaneously, the order is inserted into table "orders" within Postgresql DB.
In Telegram | In Postgresql |
---|---|
The Implementation
When a bot owner implements the order, he or she merely replies to this special message by the word "Исполнено". After that the DB considers the order implemented (by marking the column "done" as "True").
In Telegram | In Postgresql |
---|---|
The prompt
The bot owner may forget how many orders he is to attend to. Not to look it up into the DB he or she can simply ask the bot "Сколько невыполненных заказов?". In response to that, the bot will send the number of orders to carry out.