I have been trying to make a Skype bot through Python but am stuck at processing events. I have made a conversation and put the code to get events infinitely. In return, the code is supposed to respond to each message sent to the conversation only once until someone sends another message and so on. But the code runs mad and reproduces its own sent messages.
Here is the code so far:
from skpy import Skype
user = '***'
password = '***'
group_id = '***'
class MySkype(SkypeEventLoop):
def onEvent(self, event):
if (event.type == 'NewMessage'): # and (event.userId is None):
message_content = event.raw['resource']['content']
conversation_link = event.raw['resource']['conversationLink']
message_sender = event.raw['resource']['imdisplayname']
ch = sk.chats.chat(group_id)
ch.sendMsg('The code is responding to {}.\n You sent this message: {}'.format(message_sender, message_content))
sk = MySkype(user, password, autoAck = True)
sk.loop()
If you sent a message to any chat, this service will accept another new message, then you send a new message again.
Also, you keep sending to the same chat, so it seems like it reproduce the related message again & again.