private void CloseSilent(bool saveReplay) { lock (_activeBattlesLockObj) { _activeBattles.Remove(this); if (_battler0 != null) { _activeBattlers.Remove(_battler0); } if (_battler1 != null) { _activeBattlers.Remove(_battler1); } _activeChannels.Remove(_channel); _activeGuilds[_channel.Guild].Remove(this); // Only save replay if ((saveReplay is true) and (not battling an AI or (battling an AI and should save AI replays))) if (saveReplay && ((_battler0 != null && _battler1 != null) || ReplaySaver.ShouldSaveAIBattles)) { ReplaySaver.SaveReplay(_battle, BattleId); // Save battle in the lock so they don't conflict while directory checking } } _battle.OnNewEvent -= Battle_OnNewEvent; _battle.OnStateChanged -= Battle_OnStateChanged; ReactionHandler.RemoveListeners(_battler0, _battler1); }
private Task OnReactionAdded(Cacheable <IUserMessage, ulong> message, ISocketMessageChannel channel, SocketReaction reaction) { ReactionHandler.OnReactionAdded(reaction); return(Task.CompletedTask); }