digitalguide 0.0.548__tar.gz → 0.0.549__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {digitalguide-0.0.548 → digitalguide-0.0.549}/PKG-INFO +1 -1
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide/generateActions.py +9 -9
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide/generateStates.py +2 -2
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide/wa_utils.py +3 -4
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide.egg-info/PKG-INFO +1 -1
- {digitalguide-0.0.548 → digitalguide-0.0.549}/setup.py +1 -1
- {digitalguide-0.0.548 → digitalguide-0.0.549}/LICENSE +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/README.md +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide/__init__.py +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide/db_objects.py +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide/pattern.py +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide/send_utils.py +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide/special_actions/__init__.py +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide/special_actions/contextActions.py +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide/special_actions/imageActions.py +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide/special_actions/listenfrageActions.py +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide/special_actions/schaetzfragenActions.py +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide/special_actions/writeActions.py +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide.egg-info/SOURCES.txt +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide.egg-info/dependency_links.txt +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide.egg-info/requires.txt +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide.egg-info/top_level.txt +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/setup.cfg +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/tests/test_emoji_pattern.py +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/tests/test_image_actions.py +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/tests/test_jahreszahl_pattern.py +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/tests/test_kommazahl_pattern.py +0 -0
- {digitalguide-0.0.548 → digitalguide-0.0.549}/tests/test_pattern.py +0 -0
|
@@ -7,7 +7,7 @@ from pywa import types
|
|
|
7
7
|
from time import sleep
|
|
8
8
|
|
|
9
9
|
import logging
|
|
10
|
-
logging.getLogger(__name__)
|
|
10
|
+
logger = logging.getLogger(__name__)
|
|
11
11
|
|
|
12
12
|
class Action():
|
|
13
13
|
def __init__(self, actions, action_functions={}):
|
|
@@ -15,10 +15,10 @@ class Action():
|
|
|
15
15
|
self.action_functions = action_functions
|
|
16
16
|
|
|
17
17
|
def __call__(self, client, update, context, r_unsend_messages=None):
|
|
18
|
-
|
|
18
|
+
logger.info("Before sending typing indicator")
|
|
19
19
|
client.indicate_typing(update.id)
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
logger.info("Before Whatsapp Interaction creation")
|
|
22
22
|
wa_interaction = WhatsAppInteraction(
|
|
23
23
|
ProfileName=update.from_user.name,
|
|
24
24
|
WaId=update.from_user.wa_id,
|
|
@@ -34,14 +34,14 @@ class Action():
|
|
|
34
34
|
first_iter = True
|
|
35
35
|
for i in range(max_wait_itteration):
|
|
36
36
|
if not r_unsend_messages.get(update.from_user.wa_id):
|
|
37
|
-
|
|
37
|
+
logger.info("Previous messages were send within {} s.".format(i * 0.1))
|
|
38
38
|
break
|
|
39
39
|
if first_iter:
|
|
40
40
|
first_iter = False
|
|
41
41
|
client.indicate_typing(update.id)
|
|
42
42
|
sleep(0.1)
|
|
43
43
|
else:
|
|
44
|
-
|
|
44
|
+
logger.info("Previous messages were not send within {} s.".format(max_wait_itteration * 0.1))
|
|
45
45
|
|
|
46
46
|
try:
|
|
47
47
|
result = None
|
|
@@ -87,13 +87,13 @@ class Action():
|
|
|
87
87
|
footer_text=item.get("footer", None))
|
|
88
88
|
|
|
89
89
|
else:
|
|
90
|
-
client.send_message(
|
|
90
|
+
result = client.send_message(
|
|
91
91
|
to=update.from_user.wa_id,
|
|
92
92
|
text=item["text"].format(**placeholder_dict)
|
|
93
93
|
)
|
|
94
94
|
|
|
95
95
|
elif item["type"] == "carousel":
|
|
96
|
-
|
|
96
|
+
logger.info("Carousel action detected")
|
|
97
97
|
new_cards = []
|
|
98
98
|
for i, card in enumerate(item["cards"]):
|
|
99
99
|
if "action_url" in card and "action_text" in card:
|
|
@@ -109,7 +109,7 @@ class Action():
|
|
|
109
109
|
|
|
110
110
|
new_cards.append(new_card)
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
logger.info("Cards created, sending carousel")
|
|
113
113
|
result = client.send_carousel(to=update.from_user.wa_id,
|
|
114
114
|
body=item["text"].format(**placeholder_dict),
|
|
115
115
|
cards=new_cards)
|
|
@@ -200,6 +200,6 @@ class Action():
|
|
|
200
200
|
if result:
|
|
201
201
|
r_unsend_messages.set(update.from_user.wa_id, result.id, ex=10)
|
|
202
202
|
except Exception:
|
|
203
|
-
|
|
203
|
+
logger.exception("Error during the execution of action: %s", item)
|
|
204
204
|
|
|
205
205
|
wa_interaction.save()
|
|
@@ -7,7 +7,7 @@ from digitalguide.pattern import (EMOJI_PATTERN, JA_PATTERN, JAHRESZAHL_PATTERN,
|
|
|
7
7
|
from digitalguide.wa_utils import get_message_text
|
|
8
8
|
|
|
9
9
|
import logging
|
|
10
|
-
logging.getLogger(__name__)
|
|
10
|
+
logger = logging.getLogger(__name__)
|
|
11
11
|
|
|
12
12
|
# Patterns are static constants, so compile each once at import time instead
|
|
13
13
|
# of re-compiling on every incoming message in read_state().
|
|
@@ -107,7 +107,7 @@ class RegexFilter:
|
|
|
107
107
|
|
|
108
108
|
def __call__(self, update: Message | CallbackButton | CallbackSelection) -> bool:
|
|
109
109
|
text = get_message_text(update)
|
|
110
|
-
|
|
110
|
+
logger.debug("RegexFilter: checking text %r against pattern %r", text, self.regex.pattern)
|
|
111
111
|
if text != "":
|
|
112
112
|
return re.search(self.regex, text)
|
|
113
113
|
return False
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
from pywa.types import Message, CallbackButton, CallbackSelection, MessageType
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
-
logging.getLogger(__name__)
|
|
5
|
-
|
|
4
|
+
logger = logging.getLogger(__name__)
|
|
6
5
|
|
|
7
6
|
def get_message_text(update: Message | CallbackButton | CallbackSelection) -> str:
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
logger.info(f"get_message_text: Processing update of type {type(update).__name__}")
|
|
8
|
+
logger.info(f"get_message_text: Update content: {update}")
|
|
10
9
|
|
|
11
10
|
if isinstance(update, Message):
|
|
12
11
|
if update.type == MessageType.TEXT:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide/special_actions/contextActions.py
RENAMED
|
File without changes
|
|
File without changes
|
{digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide/special_actions/listenfrageActions.py
RENAMED
|
File without changes
|
{digitalguide-0.0.548 → digitalguide-0.0.549}/digitalguide/special_actions/schaetzfragenActions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|