File tree 2 files changed +7
-1
lines changed
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 4
4
import json
5
5
from howdoi .howdoi import howdoi
6
6
from path import Path
7
+ from tinydb import TinyDB , Query
7
8
9
+ db = TinyDB ('messages.json' )
8
10
9
11
config_path = Path (__file__ ).parent / 'config.json'
10
12
info = json .load (open (config_path ))
39
41
def telegram_webhook ():
40
42
update = request .get_json ()
41
43
app .logger .info (update )
42
- if "message" in update :
44
+ msg = Query ()
45
+ if "message" in update and len (db .search (db .message_id == update ['message' ]['message_id' ])) == 0 :
46
+
47
+ db .insert (update ['message' ])
43
48
text = update ["message" ]["text" ]
44
49
args = {
45
50
'query' : text .split (' ' )
Original file line number Diff line number Diff line change @@ -14,5 +14,6 @@ pyquery==1.4.0
14
14
requests == 2.21.0
15
15
requests-cache == 0.4.13
16
16
telepot == 12.7
17
+ tinydb == 3.12.2
17
18
urllib3 == 1.24.1
18
19
Werkzeug == 0.14.1
You can’t perform that action at this time.
0 commit comments