Пример #1
0
        public async Task DoPaginationAsync(IPaginationRequest request)
        {
            await ResetReactionsAsync(request).ConfigureAwait(false);

            this._requests.Add(request);
            try
            {
                var tcs = await request.GetTaskCompletionSourceAsync().ConfigureAwait(false);

                await tcs.Task.ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                this._client.Logger.LogError(InteractivityEvents.InteractivityPaginationError, ex, "Exception occurred while paginating");
            }
            finally
            {
                this._requests.TryRemove(request);
                try
                {
                    await request.DoCleanupAsync().ConfigureAwait(false);
                }
                catch (Exception ex)
                {
                    this._client.Logger.LogError(InteractivityEvents.InteractivityPaginationError, ex, "Exception occurred while paginating");
                }
            }
        }
Пример #2
0
        public async Task DoPaginationAsync(IPaginationRequest request)
        {
            await ResetReactionsAsync(request);

            this._requests.Add(request);
            try
            {
                var tcs = await request.GetTaskCompletionSourceAsync();

                await tcs.Task;
                await request.DoCleanupAsync();
            }
            catch (Exception ex)
            {
                this._client.DebugLogger.LogMessage(LogLevel.Error, "Interactivity",
                                                    $"Something went wrong with exception {ex.GetType().Name}.", DateTime.Now);
            }
            finally
            {
                this._requests.TryRemove(request);
            }
        }