File tree Expand file tree Collapse file tree 2 files changed +17
-22
lines changed Expand file tree Collapse file tree 2 files changed +17
-22
lines changed Original file line number Diff line number Diff line change 1919# https://regex101.com/r/eMmguY/1
2020@app .message (re .compile (r"@(\d+\b)" ))
2121def post_link (say , context , event ):
22+ # build message contents
23+ text = ""
2224 for match in context ['matches' ]:
2325 url = posts_url + match
24-
25- blocks = [{
26- "type" : "section" ,
27- "text" : {
28- "type" : "mrkdwn" ,
29- "text" : f"<{ url } |View post { match } on Piazza>"
30- }
31-
32- }]
33-
34- thread_ts = event .get ("thread_ts" , None )
35- if thread_ts == None :
36- say (
37- blocks = blocks ,
38- thread_ts = event .get ("ts" ),
39- reply_broadcast = True
40- )
41- else :
42- say (
43- blocks = blocks ,
44- thread_ts = thread_ts
45- )
26+ text += f"<{ url } |View post { match } on Piazza>\n "
27+
28+ # send the message
29+ thread_ts = event .get ("thread_ts" , None )
30+ if thread_ts == None :
31+ say (
32+ text = text .strip ("\n " ),
33+ thread_ts = event .get ("ts" ),
34+ reply_broadcast = True
35+ )
36+ else :
37+ say (
38+ blocks = text .strip ("\n " ),
39+ thread_ts = thread_ts
40+ )
4641
4742
4843# Run the app
You can’t perform that action at this time.
0 commit comments