File tree Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change 1- # piazza-bot
2- Slack bot that expands piazza post numbers to include a link to the actual
1+ # PiazzaBot
2+ PiazzaBot is a simple slack bot that makes discussing posts on Piazza easier.
3+ When a post is mentioned by ID, PiazzaBot will respond with a link to that
34post.
45
5- ## Dependencies
6- Slack Bolt
7- python dotenv
6+ ## Installation
7+ [ to do]
8+
9+ ## Development
10+ PiazzaBot is built using [ Slack's Bolt framework] {https://github.com/SlackAPI/bolt-python} .
Original file line number Diff line number Diff line change 88
99# Make the app
1010load_dotenv ()
11+
1112app = App (token = os .environ .get ("SLACK_BOT_TOKEN" ))
12- url = "https://piazza.com/class/%s/post/" % os .environ .get ("COURSE_ID" )
13+
14+ base_url = "https://piazza.com/class/%s" % os .environ .get ("COURSE_ID" )
15+ posts_url = f"{ base_url } /post/"
1316
1417# Listens to incoming messages that contain "hello"
15- # To learn available listener arguments,
16- # visit https://slack.dev/bolt-python/api-docs/slack_bolt/kwargs_injection/args.html
18+ # To learn available listener arguments, visit
19+ # https://slack.dev/bolt-python/api-docs/slack_bolt/kwargs_injection/args.html
1720@app .message (re .compile ("(@\d*)" ))
18- # @app.message(re.compile("(hi|hello|hey)"))
19- def message_hello (say , context ):
21+ def post_link (say , context ):
2022 for match in context ['matches' ]:
2123 number = match .replace ('@' ,'' )
22- post_url = url + number
24+ url = posts_url + number
2325 # say() sends a message to the channel where the event was triggered
24- say (f"The number is { number } . the url is: { post_url } " )
25-
26+ say (url )
2627
2728# Run the app
2829if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments