看了很多文章都说claude slack api都要创建channel ,但是我试了没有效果,看了这个文章后 https://t.cn/A6plngdc 发现不需要。一点点地边抄边写就成功了
import time
slack_user_token = "---------------"#创建应用的user token
channel_id="---------------" #claude应用的频道ID
CLAUDE_BOT_ID="-----------------"#claude应用的成员ID
question="DB2 删除表数据后如何释放硬盘空间?"
client = WebClient(token=slack_user_token)
answer=""
try:
response = client.chat_postMessage(
channel=channel_id,#claude应用的频道ID
text=question
)
ts=response["ts"]
for _ in range(150):
try:
resp = client.conversations_history(channel=channel_id, oldest=ts, limit=2)
print("r: ", resp)
msg = [msg["text"] for msg in resp["messages"] if msg["user"] == CLAUDE_BOT_ID]
if msg and not msg[-1].endswith("Typing…_"):
answer= msg[-1]
break
except (SlackApiError, KeyError) as e:
print(f"Get reply error: {e}")
break
time.sleep(1)
except SlackApiError as e:
# You will get a SlackApiError if "ok" is False
assert e.response["error"] # str like 'invalid_auth', 'channel_not_found'
print(answer)
import time
slack_user_token = "---------------"#创建应用的user token
channel_id="---------------" #claude应用的频道ID
CLAUDE_BOT_ID="-----------------"#claude应用的成员ID
question="DB2 删除表数据后如何释放硬盘空间?"
client = WebClient(token=slack_user_token)
answer=""
try:
response = client.chat_postMessage(
channel=channel_id,#claude应用的频道ID
text=question
)
ts=response["ts"]
for _ in range(150):
try:
resp = client.conversations_history(channel=channel_id, oldest=ts, limit=2)
print("r: ", resp)
msg = [msg["text"] for msg in resp["messages"] if msg["user"] == CLAUDE_BOT_ID]
if msg and not msg[-1].endswith("Typing…_"):
answer= msg[-1]
break
except (SlackApiError, KeyError) as e:
print(f"Get reply error: {e}")
break
time.sleep(1)
except SlackApiError as e:
# You will get a SlackApiError if "ok" is False
assert e.response["error"] # str like 'invalid_auth', 'channel_not_found'
print(answer)
#亲子鉴定亲子鉴定机构##佛山法院亲子鉴定电话多少#dna鉴定的常见方法有哪些?(1)传统式的dna鉴定是血型鉴定。一般小孩6个多月才可以做,需用大量的血样。这些方式麻烦、痛苦且差错率高。传统式的血型判断在一定程度上有其作用,但dna鉴定无法以血型为根据。(2)DNA鉴定。DNAdna鉴定取自任何的人体细胞(如口腔上皮细胞),还可以在孩子出生前完成。该方法是现阶段dna鉴定中最准确的一种(准确度达到99.999%),具备精致、简易、迅速、经济发展、实用的特点。亲子关系相对关系(RCP),按照世界各国dna鉴定的实践,当RCP值大于99.73%时,能够认为爸爸与小孩有亲生关系。(3)SNP检测。现阶段DNAdna鉴定是利用人类基因组中的重复碱基序列(STR做为第2代分子标记)和PCR技术性来鉴定个体,但是STR有较大的局限,SNP是第3代分子标记技术性,这也是未来发展方向。#亲子鉴定多少钱佛山#!
夸克文档:党员转正思想汇报范文2023.dochttps://vt.quark.cn/blm/quark-doc-ssr-293/preview?id=D50C5AC50F955793DC65F199E4C3B4DE&q=%E9%A2%84%E5%A4%87%E5%85%9A%E5%91%98%E8%BD%AC%E6%AD%A3%E6%80%9D%E6%83%B3%E6%B1%87%E6%8A%A52023&uc_param_str=dnntnwvepffrgibijbprsvpidsdicheiutkp&&fp_from=sc&sid=33cd721f7e92e9e5d6da777b0f6928e1&page=1&extType=0&library_loadingPage_ab=&previewShare=previewShare
✋热门推荐