Skip to content

Using app.Services.CreateScope() to load BotProperties? #1

Open

Description

@fseffert

I have a question regarding to this code snippet from the ShopBot:

// Make sure ShopBotProperties is working. _ = scope.ServiceProvider.GetRequiredService<ShopBotProperties>();
What is happening here exactly?

I did my own Bot using your library and the bot will never register a webhook with Telegram if I do not add this snippet also. Is it to force load the properties? Is this the best way to do it?

Thank you for helping me out :-)

Activity

  1. Eptagone commented on Jan 2, 2025

    @Eptagone
    Owner

    Hi, I'm really sorry for the delay.
    The webhook was registered in the constructor of ShopBotproperties but I discated that approach because was ugly. Now I the bot use a hosted service to initialize the bot commands and webhook. That's the best way I have found until now, but you can try other approaches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions