问题
Hey i'm building a skypebot and i can't figure out why i'm receiving the message 2x
This is the code im using
private void Form1_Load(object sender, EventArgs e)
{
client = new Skype();
client.MessageStatus += Client_MessageStatus;
AttachToSkype();
}
private void Client_MessageStatus(ChatMessage pMessage, TChatMessageStatus Status)
{
MessageBox.Show(pMessage.Sender.Handle + " Says: " + pMessage.Body);
}
Thanks for your time -Tristan
回答1:
MessageStatus event is called every time message's status has been changed.
You need check for TChatMessageStatus. It should be cmsReceived.
private static void Skype_MessageStatus(ChatMessage pMessage, TChatMessageStatus Status)
{
if (Status != TChatMessageStatus.cmsReceived) return;
MessageBox.Show(pMessage.Sender.Handle + " Says: " + pMessage.Body);
}
来源:https://stackoverflow.com/questions/39058352/receiving-the-same-message-twice