feat(work): add signed task progress and durable status cards

This commit is contained in:
ex_tianzy
2026-11-12 15:18:21 +08:00
parent 2e0d5987c0
commit abe2550dd0
11 changed files with 439 additions and 2 deletions
+16
View File
@@ -122,6 +122,22 @@ class Feishu:
headers={"Authorization": f"Bearer {token}"},
json={"msg_type": "text", "content": json.dumps({"text": text}, ensure_ascii=False)})
async def reply_task_card(self,message_id,card,delivery_id,*,token):
import re
if not re.fullmatch(r'[A-Za-z0-9_-]{1,128}',message_id):raise PlatformError('invalid reply reference')
data=await self._json('POST',f'/open-apis/im/v1/messages/{message_id}/reply',
headers={'Authorization':'Bearer '+token},json={'msg_type':'interactive',
'content':json.dumps(card,ensure_ascii=False),'uuid':delivery_id})
result=data.get('data',{}).get('message_id')
if not isinstance(result,str)or not re.fullmatch(r'[A-Za-z0-9_-]{1,128}',result):raise PlatformError('card receipt invalid')
return result
async def update_task_card(self,message_id,card,*,token):
import re
if not re.fullmatch(r'[A-Za-z0-9_-]{1,128}',message_id):raise PlatformError('invalid card reference')
await self._json('PATCH',f'/open-apis/im/v1/messages/{message_id}',
headers={'Authorization':'Bearer '+token},json={'content':json.dumps(card,ensure_ascii=False)})
async def download_message_file(self,message_id,file_key,max_bytes):
import re
if not re.fullmatch(r'[A-Za-z0-9_-]{1,128}',message_id)or not re.fullmatch(r'[A-Za-z0-9_-]{1,256}',file_key):raise PlatformError('invalid file reference')