SendChatMessage() protected method

A helper method for sending a chat message to the other user in the chat window (as opposed to the trade window) after a given delay
protected SendChatMessage ( int delayMs, string message ) : void
delayMs int The delay, in milliseconds, to wait before sending the message
message string The message to send to the other user
return void
Ejemplo n.º 1
0
        public async void ChatAsync(UserHandler user, string msg)
        {
            if (pendingMessages.Contains(user.OtherSID)) // don't let them chat if they didn't get a response yet
            {
                return;
            }

            AddPending(user.OtherSID);

            try
            {
                string response = await ThinkAsync(msg);

                if (user.GetState() != EPersonaState.Offline) // in case they disconnected
                {
                    user.SendChatMessage(response);
                }
            }
            catch (System.Net.WebException ex)
            {
                user.Bot.Log.Error("WebException occured in ChatSession: {0}", ex.Message);
            }

            RemovePending(user.OtherSID);
        }