Skip to content

Commit 9b7fff6

Browse files
authored
Merge pull request #11 from nossas/feature/melhoria-usabilidade
Aumenta delay para 1.5
2 parents f8a2ac2 + d8ed4bd commit 9b7fff6

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

whatsapp_connector.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async def send_text_message(self, recipient_id: Text, text: Text, **kwargs: Any)
4141
logger.debug(f"➡️ Enviando mensagem para {recipient_id}: {text}")
4242
for message_part in text.strip().split("\n\n"):
4343
self.send_message(message_part, recipient_id=recipient_id)
44-
await asyncio.sleep(1)
44+
await asyncio.sleep(1.5)
4545

4646
async def send_custom_json(self,recipient_id, custom, **kwargs: Any) -> None:
4747
logger.debug(f"Enviando custom json para {recipient_id}: {custom}")
@@ -97,7 +97,7 @@ async def send_custom_json(self,recipient_id, custom, **kwargs: Any) -> None:
9797
self.send_video(custom.get('url'),recipient_id)
9898
if custom.get('is_last'):
9999
await asyncio.sleep(0.5)
100-
await asyncio.sleep(1)
100+
await asyncio.sleep(1.5)
101101

102102

103103
async def send_text_with_buttons(
@@ -117,31 +117,31 @@ async def send_text_with_buttons(
117117
}
118118

119119
self.send_reply_button(recipient_id=recipient_id,button=button_dict )
120-
await asyncio.sleep(1)
120+
await asyncio.sleep(1.5)
121121

122122
async def send_image_url(self, recipient_id: Text, image: Text, **kwargs: Any) -> None:
123123
"""Sends an image."""
124124
# self.send_custom_json(recipient_id,{type: "typing"})
125125
self.send_image(image, recipient_id=recipient_id)
126-
await asyncio.sleep(1)
126+
await asyncio.sleep(1.5)
127127

128128
async def send_video_url(self, recipient_id: Text, video: Text, **kwargs: Any) -> None:
129129
# self.send_custom_json(recipient_id,{type: "typing"})
130130
"""Sends a Video"""
131131
self.send_video(video, recipient_id=recipient_id)
132-
await asyncio.sleep(1)
132+
await asyncio.sleep(1.5)
133133

134134
async def send_document_url(self, recipient_id: Text, document: Text, **kwargs: Any) -> None:
135135
# self.send_custom_json(recipient_id,{type: "typing"})
136136
"""Sends a Document"""
137137
self.send_document(document, recipient_id=recipient_id)
138-
await asyncio.sleep(1)
138+
await asyncio.sleep(1.5)
139139

140140
async def send_audio_url(self, recipient_id: Text, audio: Text, **kwargs: Any) -> None:
141141
# self.send_custom_json(recipient_id,{type: "typing"})
142142
"""Sends an Audio"""
143143
self.send_audio(audio, recipient_id=recipient_id)
144-
await asyncio.sleep(1)
144+
await asyncio.sleep(1.5)
145145

146146
class WhatsAppInput(InputChannel):
147147
"""WhatsApp Cloud API input channel"""
@@ -193,7 +193,7 @@ async def handle_media(self, sender_id, media_object, on_new_message, out_channe
193193

194194
async def finalize_media_batch(self, sender_id, on_new_message, out_channel):
195195
try:
196-
await asyncio.sleep(3)
196+
await asyncio.sleep(4)
197197
medias = self.media_cache.pop(sender_id, [])
198198
self.media_timers.pop(sender_id, None)
199199

0 commit comments

Comments
 (0)