private void HandleAbortedTrade(PokeTradeDetail <PB8> detail, PokeRoutineType type, uint priority, PokeTradeResult result) { detail.IsProcessing = false; if (result.ShouldAttemptRetry() && detail.Type != PokeTradeType.Random && !detail.IsRetry) { detail.IsRetry = true; Hub.Queues.Enqueue(type, detail, Math.Min(priority, PokeTradePriorities.Tier2)); detail.SendNotification(this, "Oops! Something happened. I'll requeue you for another attempt."); } else { detail.SendNotification(this, $"Oops! Something happened. Canceling the trade: {result}."); detail.TradeCanceled(this, result); } }
public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg) { OnFinish?.Invoke(routine); var line = $"@{info.Trainer.TrainerName}: Trade canceled, {msg}"; LogUtil.LogText(line); SendMessage(line, Settings.TradeCanceledDestination); }
public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg) { LogUtil.LogInfo($"Canceling trade with {info.Trainer.TrainerName}, because {msg}.", routine.Connection.Name); OnFinish?.Invoke(routine); }
public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg) { OnFinish?.Invoke(routine); Context.User.SendMessageAsync($"Trade canceled: {msg}").ConfigureAwait(false); }
public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg) { Client.SendMessage(Channel, $"Trade canceled: {msg}"); OnFinish?.Invoke(routine); }
public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeResult msg) => Notifier.TradeCanceled(routine, this, msg);
public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg) { OnFinish?.Invoke(routine); Trader.SendMessageAsync($"Trade canceled: {msg}").ConfigureAwait(false); if (info.Type == PokeTradeType.TradeCord) { TradeExtensions.TradeStatusUpdate(Trader.Id.ToString(), true); } }
public static bool AttemptRetry(this PokeTradeResult t) => t != PokeTradeResult.Success && t >= PokeTradeResult.Aborted;
public static bool ShouldAttemptRetry(this PokeTradeResult t) => t >= PokeTradeResult.RoutineCancel;
public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg) { OnFinish?.Invoke(routine); if (info.Type == PokeTradeType.TradeCord) { var user = Context.User.Id.ToString(); var path = TradeExtensions.TradeCordPath.FirstOrDefault(x => x.Contains(user)); TradeExtensions.TradeCordPath.Remove(path); } Context.User.SendMessageAsync($"Trade canceled: {msg}").ConfigureAwait(false); }
public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg) { OnFinish?.Invoke(routine); Trader.SendMessageAsync($"Trade canceled: {msg}").ConfigureAwait(false); if (msg == PokeTradeResult.NoTrainerFound) { CommandSentChannel.SendMessageAsync($"{Trader.Mention} - Something happened with your trade: {msg}. This has been reported."); } }
public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg) { OnFinish?.Invoke(routine); Trader.SendMessageAsync($"Trade canceled: {msg}").ConfigureAwait(false); var hub = new PokeTradeHub <PK8>(new PokeTradeHubConfig()); var qInfo = new TradeQueueInfo <PK8>(hub); if (qInfo.Count != 0) { string gameText = $"{SysCordInstance.Settings.BotGameStatus.Replace("{0}", $"Completed Trade #{info.ID}")}"; Context.Client.SetGameAsync(gameText).ConfigureAwait(false); } else { string gameText = $"{SysCordInstance.Settings.BotGameStatus.Replace("{0}", $"Queue is Empty")}"; Context.Client.SetGameAsync(gameText).ConfigureAwait(false); } }
public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg) { OnFinish?.Invoke(routine); NotifyServerOfState(WebTradeState.Canceled); }
public void TradeCanceled(PokeRoutineExecutor routine, PokeTradeDetail <T> info, PokeTradeResult msg) { if (Hub.Config.Trade.EggRaffle && info.TradeData.IsEgg) { System.IO.StreamReader reader = new System.IO.StreamReader("EggRngBlacklist.txt"); var content = reader.ReadToEnd(); reader.Close(); var id = System.Text.RegularExpressions.Regex.Match(Context.User.Mention, @"\D*(\d*)", System.Text.RegularExpressions.RegexOptions.Multiline).Groups[1].Value; var parse = System.Text.RegularExpressions.Regex.Match(content, @"(" + id + @") - (\S*\ \S*\ \w*)", System.Text.RegularExpressions.RegexOptions.Multiline); if (content.Contains(id)) { content = content.Replace(parse.Groups[0].Value, $"{id} - 1/11/2000 12:00:00 AM").TrimEnd(); System.IO.StreamWriter writer = new System.IO.StreamWriter("EggRngBlacklist.txt"); writer.WriteLine(content); writer.Close(); OnFinish?.Invoke(routine); Context.User.SendMessageAsync($"Trade canceled: {msg}. EggRaffle cooldown was reset.").ConfigureAwait(false); } } else { OnFinish?.Invoke(routine); Context.User.SendMessageAsync($"Trade canceled: {msg}").ConfigureAwait(false); } }
public void TradeCanceled(PokeRoutineExecutor <T> routine, PokeTradeDetail <T> info, PokeTradeResult msg) { if (info.Type == PokeTradeType.TradeCord) { TradeCordHelper <T> .HandleTradedCatches(Trader.Id, false); } OnFinish?.Invoke(routine); Trader.SendMessageAsync($"Trade canceled: {msg}").ConfigureAwait(false); }