Skip to content

Commit

Permalink
新增设置群聊名称接口--set_group_name
Browse files Browse the repository at this point in the history
新增设置群聊名称接口--set_group_name
  • Loading branch information
vivre90 authored Oct 13, 2016
1 parent 614c875 commit 95729f4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions wxbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,24 @@ def delete_user_from_group(self,uname,gid):
dic = r.json()
return dic['BaseResponse']['Ret'] == 0

def set_group_name(self,gid,gname):
"""
设置群聊名称
"""
url = self.base_uri + '/webwxupdatechatroom?fun=modtopic&pass_ticket=%s' % self.pass_ticket
params ={
"NewTopic": gname,
"ChatRoomName": gid,
"BaseRequest": self.base_request
}
headers = {'content-type': 'application/json; charset=UTF-8'}
data = json.dumps(params, ensure_ascii=False).encode('utf8')
try:
r = self.session.post(url, data=data, headers=headers)
except (ConnectionError, ReadTimeout):
return False
dic = r.json()
return dic['BaseResponse']['Ret'] == 0

def send_msg_by_uid(self, word, dst='filehelper'):
url = self.base_uri + '/webwxsendmsg?pass_ticket=%s' % self.pass_ticket
Expand Down

0 comments on commit 95729f4

Please sign in to comment.