简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM