internal void UnassignBot(long interactionId, UnassignmentReason reason) { using (Trace.BotManager.scope()) { try { Console.WriteLine("UnassignBot ({0})", interactionId); // Unassign bot IChatBot assignedBot = null; if (_interactionAssignments.ContainsKey(interactionId)) { assignedBot = _interactionAssignments[interactionId]; _interactionAssignments.Remove(interactionId); } // Let the bot know the bad news if (assignedBot != null) { assignedBot.InteractionUnassigned(interactionId, reason); } } catch (Exception ex) { Trace.BotManager.exception(ex); } } }
private void UnassignChat(ChatInteraction chat, UnassignmentReason reason) { using (Trace.Main.scope()) { try { // Unassign _botManager.UnassignBot(chat.InteractionId.Id, reason); // Stop watches if (chat.ChatIsWatching()) { chat.ChatStopWatching(); } if (chat.IsWatching()) { chat.StopWatching(); } // Remove event handlers chat.TextAdded -= ChatOnTextAdded; chat.UrlAdded -= ChatOnUrlAdded; } catch (Exception ex) { Trace.Main.exception(ex); } } }
public void InteractionUnassigned(long interactionId, UnassignmentReason reason) { Console.WriteLine("[{0}] - InteractionUnassigned ({1}, {2})", BotName, interactionId, reason); }