The following small script should work. (Assuming you already have group chat open)
def sendGroupChatMessage(): """ Send Group Chat Messages. """ import Skype4Py as skype skypeClient = skype.Skype() skypeClient.Attach() for elem in skypeClient.ActiveChats: if len(elem.Members) > 2: elem.SendMessage("SomeMessageHere")
I basically import all current chats, checking the number of participants and sending a message accordingly. It should also be easy to check in different groups.
To get pens, change your function to this.
def sendGroupChatMessage(): """ Send Group Chat Messages. """ import Skype4Py as skype skypeClient = skype.Skype() skypeClient.Attach() for elem in skypeClient.ActiveChats: if len(elem.Members) > 2: for friend in elem.Members: print friend.Handle elem.SendMessage("SomeMessageHere")
If you can tag your chat, you just need to do it.
>>> groupTopic = 'Insert a Topic Here' >>> for chat in skypeClient.BookmarkedChats: if chat.Topic == groupTopic: chat.SendMessage("Send a Message Here")
This is the final code that should be standalone.
def sendGroupChatMessage(topic=""): """ Send Group Chat Messages. """ import Skype4Py as skype skypeClient = skype.Skype() skypeClient.Attach() messageSent = False for elem in skypeClient.ActiveChats: if len(elem._GetMembers()) > 2 and elem.Topic == topic: elem.SendMessage("SomeMessageHere") messageSent = True if not messageSent: for chat in skypeClient.BookmarkedChats: if chat.Topic == topic: chat.SendMessage("SomeMessageHere") messageSent = True return messageSent
source share