首页 > 解决方案 > Skype + C# - Invalid chat name

问题描述

I am creating a C # system integrated with Skype that, when someone sends a message containing certain keywords in a specific group, my client should send a preconfigured message in that same chat.

I created a method in my program that verifies the unread messages from my Skype to see if any of them have the requirements I quoted (I'm using the Skype4COM API, if you know of any other better APIs, type here in the topic):

private void checkMessages()
{
    foreach (ChatMessage cm in _skype.MissedMessages)
    {
        if (cm.Body.StartsWith("Ninho lindo") || cm.Body.StartsWith("Ninho é lindo"))
        {
            if (cm.Chat.FriendlyName.Equals("Testes"))
            {
                if (ligado)
                {
                    cm.Chat.OpenWindow();
                    cm.Chat.SendMessage("Analisando...");
                }
            }
        }
    }
}

Apparently, looking at the program is all right, but when I run it, the problem occurs in this line of code:

if (cm.Chat.FriendlyName.Equals("Testes"))

The error displayed is as follows: System.Runtime.InteropServices.COMException: 'Invalid chat name'

The description of the error does not fit the reality, since the chats exist and they have their respective names. If anyone can help me, I'll be grateful! I await your response.

标签: c#skypeskype4com

解决方案


推荐阅读