updaet
This commit is contained in:
parent
beadaf8ff7
commit
79a856f8c5
@ -112,7 +112,7 @@ class WecomClient:
|
|||||||
logging.error(f"unionid_to_external_userid异常: {str(e)}")
|
logging.error(f"unionid_to_external_userid异常: {str(e)}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
async def send_welcome_message(self, group_id: str) -> bool:
|
async def send_welcome_message(self, chat_id: str) -> bool:
|
||||||
"""发送欢迎消息"""
|
"""发送欢迎消息"""
|
||||||
try:
|
try:
|
||||||
# 1. 获取 access_token
|
# 1. 获取 access_token
|
||||||
@ -122,10 +122,9 @@ class WecomClient:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# 2. 发送欢迎消息
|
# 2. 发送欢迎消息
|
||||||
url = "https://qyapi.weixin.qq.com/cgi-bin/message/send"
|
url = f"https://qyapi.weixin.qq.com/cgi-bin/appchat/send?access_token={access_token}"
|
||||||
params = {
|
data = {
|
||||||
"access_token": access_token,
|
"chatid": chat_id,
|
||||||
"group_id": group_id,
|
|
||||||
"msgtype": "text",
|
"msgtype": "text",
|
||||||
"text": {
|
"text": {
|
||||||
"content": f"""🥳 欢迎您进群,在群内可以享受📦【代取快递】跑腿服务。
|
"content": f"""🥳 欢迎您进群,在群内可以享受📦【代取快递】跑腿服务。
|
||||||
@ -137,11 +136,12 @@ class WecomClient:
|
|||||||
𝟐 赠送𝟔枚鲜鸡蛋【首次下单】
|
𝟐 赠送𝟔枚鲜鸡蛋【首次下单】
|
||||||
━ ━ ━ ━ ━🎊━ ━ ━ ━ ━
|
━ ━ ━ ━ ━🎊━ ━ ━ ━ ━
|
||||||
↓点击↓小程序领券下单 &"""
|
↓点击↓小程序领券下单 &"""
|
||||||
}
|
},
|
||||||
|
"safe": 0
|
||||||
}
|
}
|
||||||
|
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
async with session.post(url, json=params) as response:
|
async with session.post(url, json=data) as response:
|
||||||
result = await response.json()
|
result = await response.json()
|
||||||
if result.get("errcode") == 0:
|
if result.get("errcode") == 0:
|
||||||
return True
|
return True
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user