'Create and release class instances from async task

When receiving commands in a telegram, there is a need to dynamically create and release class instances. I'm using Net6 and NuGet package "Telegram.Bot.Extensions.Polling" Version="1.0.2". Just getting into c# on net6 and asynchronous programming. Do I understand correctly that you need to create a class and a static variable \ method in it and call it from an asynchronous task? Or how can it be done better?

...
///Main
botClient.StartReceiving(HandleUpdateAsync,HandleErrorAsync,receiverOptions,cancellationToken: cts.Token);
...
async Task HandleUpdateAsync(ITelegramBotClient botClient, Update update, CancellationToken cancellationToken)
{
    ...
    if (messageText!.StartsWith("/start "))
    {
        ...
        await botClient.SendTextMessageAsync(
                                                chatId: chatId,
                                                text: "start",
                                                cancellationToken: cancellationToken);
    }
    ...
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source