File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -27,3 +27,22 @@ def packet_signed_notification(packet, signer):
2727 print (onesignal_response .json ())
2828 if onesignal_response .status_code == 200 :
2929 app .logger .info ("The notification ({}) sent out successfully" .format (notification .post_body ))
30+
31+
32+ def packet_100_percent_notification (packet ):
33+ subscriptions = NotificationSubscription .query .all ()
34+ if subscriptions :
35+ tokens = list (filter (lambda subscription : subscription .token , subscriptions ))
36+
37+ notification = onesignal .Notification (post_body = post_body )
38+ notification .post_body ["content" ]["en" ] = packet .freshman .name + ' got 💯 on packet!'
39+ notification .post_body ["headings" ]["en" ] = 'New 100% on Packet!'
40+ # TODO: Issue #156
41+ notification .post_body ["chrome_web_icon" ] = 'https://profiles.csh.rit.edu/image/' + packet .freshman_username
42+ notification .post_body ["include_player_ids" ] = tokens
43+
44+ onesignal_response = onesignal_client .send_notification (notification )
45+ print (onesignal_response .status_code )
46+ print (onesignal_response .json ())
47+ if onesignal_response .status_code == 200 :
48+ app .logger .info ("The notification ({}) sent out successfully" .format (notification .post_body ))
You can’t perform that action at this time.
0 commit comments