コード例 #1
0
        public async Task AddCallBackGroup(CallBackGroup callBackGroup, CancellationToken cancellationToken = default)
        {
            using var scope         = _serviceScope.CreateScope();
            await using var context = scope.ServiceProvider.GetRequiredService <BotDbContext>();
            await context.CallBackGroups.AddAsync(callBackGroup, cancellationToken);

            await context.SaveChangesAsync(cancellationToken);
        }
コード例 #2
0
ファイル: MessageSender.cs プロジェクト: mtapkanov/Botix
        private async Task AddCallBackGroup(ButtonMessage message, CancellationToken cancellationToken)
        {
            var callBack = new CallBackGroup(message.MessageCallBack);

            callBack.AddButtons(message.Buttons.Select(x => (x.Text, x.PressCallBack))
                                .ToArray());

            await _callBackButtonProvider.AddCallBackGroup(callBack, cancellationToken);
        }