Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: improve message sending #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,17 @@ mensagem = ReadMessage(
response = client.chat.mark_message_as_read(instance_id, [mensagem], instance_token)
```

#### Obter Mensagens do Chat
```python
response = client.chat.get_messages(
instance_id,
remote_jid="[email protected]",
instance_token=instance_token,
page=1, # página opcional (padrão: 1)
offset=50 # limite de mensagens por página opcional (padrão: 50)
)
```

### Chamadas

#### Simular Chamada
Expand Down
Binary file removed evolutionapi/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file removed evolutionapi/__pycache__/client.cpython-310.pyc
Binary file not shown.
Binary file removed evolutionapi/__pycache__/exceptions.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file removed evolutionapi/models/__pycache__/call.cpython-310.pyc
Binary file not shown.
Binary file removed evolutionapi/models/__pycache__/chat.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed evolutionapi/services/__pycache__/call.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 3 additions & 6 deletions evolutionapi/services/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@ def __init__(self, client):

def send_text(self, instance_id: str, message: TextMessage, instance_token: str):
# Preparar os dados como JSON
data = {
'number': message.number,
'text': message.text
}
data = {}

if hasattr(message, 'delay') and message.delay is not None:
data['delay'] = message.delay
# Add all additional kwargs to data dictionary
data.update(message.__dict__)

# Usar o método post do cliente que já trata JSON corretamente
return self.client.post(
Expand Down