c# - 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.
解决方案
推荐阅读
- python - 在 Python 中使用来自 .env Laravel 的数据
- excel - 使用 Vlookup 进行条件匹配
- android - 我在构建 apk 并安装时有一个关于在颤振中使用 Shared_Preferences 的问题
- android - 如何仅打印 json 映射中值的特定部分?
- java - 平台/框架/基础是如何构建的?AOSP 源
- arrays - AngularJS 计算数组中匹配的次数
- reactjs - React 路由器渲染无效组件然后渲染有效组件
- vba - 如何使用 vba 遍历文档中的所有段落
- eclipse - 如何在 nattable 中按列标题层分组实现文本换行
- mongodb - 如何在 MongoDB Ops Manager 中从故障状态中恢复