public static async Task AddToQueueAsync(this SocketCommandContext Context, int code, string trainer, RequestSignificance sig, PK8 trade, PokeRoutineType routine, PokeTradeType type, SocketUser trader, string requestedIgn = "") { if ((uint)code > MaxTradeCode) { await Context.Channel.SendMessageAsync("Trade code should be 00000000-99999999!").ConfigureAwait(false); return; } IUserMessage test; try { const string helper = "I've added you to the queue! I'll message you here when your trade is starting."; test = await trader.SendMessageAsync(helper).ConfigureAwait(false); } catch (HttpException ex) { await Context.Channel.SendMessageAsync($"{ex.HttpCode}: {ex.Reason}!").ConfigureAwait(false); var noAccessMsg = Context.User == trader ? "You must enable private messages in order to be queued!" : "The mentioned user must enable private messages in order for them to be queued!"; await Context.Channel.SendMessageAsync(noAccessMsg).ConfigureAwait(false); return; } // Try adding bool result; string msg; if (requestedIgn != string.Empty) { result = Context.AddToTradeQueue(trade, code, trainer, sig, routine, type, trader, out msg, requestedIgn); } else { result = Context.AddToTradeQueue(trade, code, trainer, sig, routine, type, trader, out msg); } // Notify in channel await Context.Channel.SendMessageAsync(msg).ConfigureAwait(false); // Notify in PM to mirror what is said in the channel. await trader.SendMessageAsync(msg).ConfigureAwait(false); // Clean Up if (result) { // Delete the user's join message for privacy if (!Context.IsPrivate) { await Context.Message.DeleteAsync(RequestOptions.Default).ConfigureAwait(false); } } else { // Delete our "I'm adding you!", and send the same message that we sent to the general channel. await test.DeleteAsync().ConfigureAwait(false); } }