示例#1
0
        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);
                }
            }
        }
示例#2
0
        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);
                }
            }
        }
示例#3
0
 public void InteractionUnassigned(long interactionId, UnassignmentReason reason)
 {
     Console.WriteLine("[{0}] - InteractionUnassigned ({1}, {2})", BotName, interactionId, reason);
 }