Skip to content

Commit

Permalink
fix: webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
ZianTT authored Jun 29, 2024
1 parent ccde736 commit 9a20559
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions api.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,18 +543,30 @@ def try_create_order(self):
orderid = result["data"]["orderId"]
if self.fake_ticket(pay_token, order_id = orderid):
# self.logout()
if "pushplus" in self.config or "webhook" in self.config:
if "pushplus" in self.config:
# https://www.pushplus.plus/send/
url = self.config["webhook"] if "webhook" in self.config else "https://www.pushplus.plus/send"
url = "https://www.pushplus.plus/send"
response = requests.post(url, json={
"token": self.config["pushplus"] if "pushplus" in self.config else "",
"token": self.config["pushplus"],
"title": i18n_gt()["BHYG_notify"],
"content": i18n_gt()["rob_ok_paying"]+self.order_id,
}).json()
if response["code"] == 200:
logger.success(i18n_gt()["notify_ok"]+" "+response['data'])
else:
logger.error(i18n_gt()["notify_fail"]+" "+response)
if "webhook" in self.config:
url = self.config["webhook"]
response = requests.post(url, json={
"msg_type": "text",
"text": {
"content": i18n_gt()["rob_ok_paying"]+self.order_id,
}
}).json()
if response["code"] == 200:
logger.success(i18n_gt()["notify_ok"]+" "+response['data'])
else:
logger.error(i18n_gt()["notify_fail"]+" "+response)
if "hunter" in self.config:
return True
logger.info(i18n_gt()["unpaid_bill"])
Expand Down

0 comments on commit 9a20559

Please sign in to comment.