diff --git a/chivasbot.py b/tcr.py similarity index 98% rename from chivasbot.py rename to tcr.py index 9e79516..373e80f 100644 --- a/chivasbot.py +++ b/tcr.py @@ -1440,6 +1440,31 @@ def bot(op): kc.leaveGroup(msg.to) except: pass +#----------------------------------------------- + elif msg.text in ["Tg","Tag all"]: + group = cl.getGroup(msg.to) + jw = [contact.mid for contact in group.members] + cb = "" + cb2 = "" + strt = int(0) + akh = int(0) + for rs in jw: + xname = cl.getContact(rs).displayName + xlen = int(len('x')+1) + akh = akh + xlen + cb += """{"S":"""+json.dumps(str(strt))+""","E":"""+json.dumps(str(akh))+""","M":"""+json.dumps(rs)+"},""" + strt = strt + int(len('x')+3) + akh = akh + 2 + cb2 += "@x \n" + cb = (cb[:int(len(cb)-1)]) + msg.contentType = 0 + msg.text = cb2 + msg.contentMetadata ={'MENTION':'{"MENTIONEES":['+cb+']}','EMTVER':'d'} + try: + cl.sendMessage(msg) + except Exception as error: + print error + #----------------------------------------------- elif msg.text in ["Kill"]: if msg.toType == 2: