Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Telegram-bot data storage

I'm developing a telegram bot which needs to store datas for each user. Is there a way to store them directly into the phone or something particular or the only way is to save them server-side and call them back for every call?

Thanks

like image 217
Pier Giorgio Misley Avatar asked Jul 21 '16 13:07

Pier Giorgio Misley


People also ask

Can Telegram bots store data?

Python Telegram BOT ables to store and retrive data from database (create, delete and read items from your personal list) and set alarms.

Where is Telegram Bot data stored?

Telegram stores all data, i.e. all chats and also the bots, encrypted in the cloud.

Can Telegram Bot send files?

Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. See sendDocument official docs for a list of supported parameters and other info.


2 Answers

I don't get what you want to do. A telegram bot is running on your server and does only reply or send messages to the user. When you want to save data for the user, you have to save it on the server. Assuming you are using C#, you could use a database or a simple Dictionary with the UserID as key and your data as the value. Your bot can't run any code on the phone, so there is no possibility to save data there.

like image 149
Luca Schimweg Avatar answered Oct 24 '22 09:10

Luca Schimweg


Data storage handling can reside in the machine where the code telegram bot run. I developed telegram bot with node-telegram-bot-api. For data storage i used mongodb (if you are using NodeJS can follow this guide). If you will choose to use mongodb consider that you can use it with several frameworks/programming languages.

like image 35
Luca Motta Avatar answered Oct 24 '22 10:10

Luca Motta