Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist bot's and user's state and ability to create conversations #1162

Open
dvygolov opened this issue Dec 9, 2022 · 5 comments
Open

Persist bot's and user's state and ability to create conversations #1162

dvygolov opened this issue Dec 9, 2022 · 5 comments
Labels
💬 discussion enhancement 💗 help wanted Up for grabs. We would accept a PR to help resolve this issue

Comments

@dvygolov
Copy link

dvygolov commented Dec 9, 2022

Beautiful library python-telegram-bot has some killer features I'd love to see in this .NET package:

  • bot_data: a dictionary, that can be used to store some data assosiated with the bot itself. It is available in every update request.
  • user_data: a dictionary that is user specific. When we get updates from the user, we can always take a look at user's data and change smth there or get additional info from there
  • conversations: this is so-so-so cool! You can define a conversation which is just a set of triggers and handlers. One can lead to another and it is very easy to create various flows of interaction with the bot. Here is an example: https://docs.python-telegram-bot.org/en/v20.0a6/examples.persistentconversationbot.html
@tuscen tuscen added 💗 help wanted Up for grabs. We would accept a PR to help resolve this issue 💬 discussion enhancement labels Dec 10, 2022
@lorenzo93
Copy link

Hi,

I've create a small library that achieves exactly this. It is not public, because it is not separated from my business logic, but I could think about releasing it to the public if needed.
It uses the Dipendency Injection pattern and it is really easy to use :)

@Fedorus
Copy link
Member

Fedorus commented Mar 22, 2023

https://github.com/TgBotFramework

It gives you all of the above, except for conversations, but you can easily implement them. Plus you can store them in DB with some amount of EF code to support it )

Any way data that you need to store is unique to your bot, so its hard to find solution that fits everyone

@dvygolov
Copy link
Author

Any way data that you need to store is unique to your bot, so its hard to find solution that fits everyone

A simple Dictionary<string,object> will fit everyone 🙃

@Fedorus
Copy link
Member

Fedorus commented Mar 23, 2023

A simple Dictionary<string,object> will fit everyone 🙃

Dictionary<long, Dictionary<string,object>> 🙃

@lorenzo93
Copy link

You need to use Generics and do a Dictionary<long,T> so each developer could choose its own implementation. Moreover you should automatically find the scope dedicated to the user and give back the result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💬 discussion enhancement 💗 help wanted Up for grabs. We would accept a PR to help resolve this issue
Projects
None yet
Development

No branches or pull requests

4 participants