ming 3 лет назад
Родитель
Сommit
95a669a732
1 измененных файлов с 14 добавлено и 1 удалено
  1. 14 1
      newbot.py

+ 14 - 1
newbot.py

@@ -20,6 +20,7 @@ from matplotlib import dates
 import dataset
 import matplotlib.dates as mdates
 import random
+import requests
 #
 
 
@@ -74,6 +75,17 @@ handler = WebhookHandler('f761bc6038c94a3baa815124e33dea50')
 #line_bot_api = LineBotApi('YOUR_CHANNEL_ACCESS_TOKEN')
 #handler = WebhookHandler('YOUR_CHANNEL_SECRET')
 
+
+def notify_group(msg):
+    glist=['1dbtJHbWVbrooXmQqc4r8OyRWDryjD4TMJ6DiDsdgsX']
+    for gid in glist:
+        headers = {
+                "Authorization": "Bearer " + gid,
+                "Content-Type": "application/x-www-form-urlencoded"
+        }
+        params = {"message": msg}   
+        r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params=params)
+
 def get_aws():
     result=''
     db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/hhh?charset=utf8mb4')
@@ -310,7 +322,8 @@ def message_text(event):
 # #                   TextSendMessage(text='PUSH!'),
 #                ]
 #            )
-
+    notify_group('User :'+event.message.text)
+    
     if event.message.text == 's_news':
         s_news=True
         line_bot_api.reply_message(