@@ -340,7 +340,7 @@ class SkypeGroupChat(SkypeChat):
340
340
still appears in the recent list despite being left or deleted.
341
341
"""
342
342
343
- attrs = SkypeChat .attrs + ("topic" , "creatorId" , "userIds" , "adminIds" , "open" , "history" , "picture" , "active" )
343
+ attrs = SkypeChat .attrs + ("topic" , "creatorId" , "userIds" , "adminIds" , "open" , "history" , "picture" , "active" , "moderatedthread" )
344
344
345
345
@classmethod
346
346
def rawToFields (cls , raw = {}, active = False ):
@@ -360,7 +360,8 @@ def rawToFields(cls, raw={}, active=False):
360
360
"open" : props .get ("joiningenabled" , "" ) == "true" ,
361
361
"history" : props .get ("historydisclosed" , "" ) == "true" ,
362
362
"picture" : props .get ("picture" , "" )[4 :] or None ,
363
- "active" : active })
363
+ "active" : active ,
364
+ "moderatedthread" : props .get ("moderatedthread" )})
364
365
return fields
365
366
366
367
@property
@@ -381,12 +382,12 @@ def setTopic(self, topic):
381
382
auth = SkypeConnection .Auth .RegToken , params = {"name" : "topic" }, json = {"topic" : topic })
382
383
self .topic = topic
383
384
384
- def setIsModerateThread (self , moderate = True ):
385
+ def setModerated (self , moderate = True ):
385
386
"""
386
- Update the chat type, and make chat moderated. An empty value make chat moderating.
387
+ Update the chat type, and make chat moderated.
387
388
388
389
Args:
389
- moderate (bool): moderating value
390
+ moderate (bool): moderating value. True as default
390
391
"""
391
392
self .skype .conn ("PUT" , "{0}/threads/{1}/properties" .format (self .skype .conn .msgsHost , self .id ),
392
393
auth = SkypeConnection .Auth .RegToken , params = {"name" : "moderatedthread" }, json = {"moderatedthread" : moderate })
@@ -503,27 +504,29 @@ def chat(self, id):
503
504
auth = SkypeConnection .Auth .RegToken , params = {"view" : "msnp24Equivalent" }).json ()
504
505
return self .merge (SkypeChat .fromRaw (self .skype , json ))
505
506
506
- def create (self , members = (), admins = ()):
507
+ def create (self , members = (), admins = (), moderated = False ):
507
508
"""
508
509
Create a new group chat with the given users.
509
510
510
511
The current user is automatically added to the conversation as an admin. Any other admin identifiers must also
511
- be present in the member list.
512
+ be present in the member list. You can also make the chat moderated by passing moderated value
512
513
513
514
Args:
514
515
members (str list): user identifiers to initially join the conversation
515
516
admins (str list): user identifiers to gain admin privileges
517
+ moderate (bool): moderating value. False as default
516
518
517
519
Returns:
518
520
:class:`SkypeGroupChat`: newly created group conversation
519
521
"""
520
522
memberObjs = [{"id" : "8:{0}" .format (self .skype .userId ), "role" : "Admin" }]
523
+ props = {"moderatedthread" : moderated }
521
524
for id in members :
522
525
if id == self .skype .userId :
523
526
continue
524
527
memberObjs .append ({"id" : "8:{0}" .format (id ), "role" : "Admin" if id in admins else "User" })
525
528
resp = self .skype .conn ("POST" , "{0}/threads" .format (self .skype .conn .msgsHost ),
526
- auth = SkypeConnection .Auth .RegToken , json = {"members" : memberObjs })
529
+ auth = SkypeConnection .Auth .RegToken , json = {"members" : memberObjs , "properties" : props })
527
530
return self .chat (resp .headers ["Location" ].rsplit ("/" , 1 )[1 ])
528
531
529
532
@staticmethod
0 commit comments