0

is there a way to check if a chat is a group chat? Or at least to find out how many users there are in a group.

Like by checking for the user number, if it is 2, then it is obviously 1-1 (Single), but if it as anything else, it would be a group chat.

Andrew Wong
  • 115
  • 10

3 Answers3

0

The Type property of the chat object will be either chatTypeDialog or chatTypeMultiChat with the latter being a group chat. You can safely ignore the other legacy enumeration values.

Claus Jørgensen
  • 25,882
  • 9
  • 87
  • 150
0

This is a slight modification of a code that I wrote for another question here. The following code checks if there are any Group chats in either the open chats or the bookmarked chats. You should pass in a topic to find a chat of that topic.

def checkGroupChat(topic=""):
    """
    Checks if a group exists.
    """
    import Skype4Py as skype
    skypeClient = skype.Skype()
    skypeClient.Attach()
    for elem in skypeClient.ActiveChats:  # Looks in active chats and returns True if chat is found.
        if len(elem.Members) > 2 and elem.Topic == topic:
            return True

    for chat in skypeClient.BookmarkedChats: # Looks in Bookmarked Chats.
        if chat.Topic == topic:
            return True

    return False
Community
  • 1
  • 1
Sukrit Kalra
  • 33,167
  • 7
  • 69
  • 71
0

This worked for me:

def on_message(message, status):
    len(message.Chat.Members) > 2:
        # this is a private chat

s = Skype4Py.Skype()
s.OnMessageStatus = on_message
s.Attach()

message.Chat.Type always hanged for me and then after some seconds the connection to Skype is lost. Seems to be a bug

hansaplast
  • 11,007
  • 2
  • 61
  • 75