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

adding readBySend #40

Merged
merged 5 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions nta/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def webhook_handler(self, req):
name = event.event
self._call_handler(name, event)

def send(self, user_id, message, quick_reply=None, notification=False, callback=None):
def send(self, user_id, message, quick_reply=None, notification=False, read_by_send=False,callback=None):
hwonyo marked this conversation as resolved.
Show resolved Hide resolved
"""
Send a message to user_id with quick_reply or not.
If notification True, push alarm occurred on user's phone.
Expand All @@ -149,6 +149,7 @@ def send(self, user_id, message, quick_reply=None, notification=False, callback=
user=user_id,
message=message,
quick_reply=quick_reply,
read_by_send=read_by_send,
notification=notification
)

Expand Down Expand Up @@ -391,4 +392,4 @@ def __error_check(self, response):
When recieved success: false, raise NaverTalkApiError.
"""
if not response.success:
raise NaverTalkApiError(response)
raise NaverTalkApiError(response)
hwonyo marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 6 additions & 3 deletions nta/models/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GenericPayload(Payload):
General Payload
For Send a message to users.
"""
def __init__(self, message, quick_reply=None, notification=False, **kwargs):
def __init__(self, message, quick_reply=None, notification=False,read_by_send=False, **kwargs):
hwonyo marked this conversation as resolved.
Show resolved Hide resolved
"""__init__ method.

Args:
Expand All @@ -33,7 +33,10 @@ def __init__(self, message, quick_reply=None, notification=False, **kwargs):
super(GenericPayload, self).__init__(**kwargs)

self.event = 'send'
self.options = {"notification": notification}
self.options = {
"notification": notification,
"readBySend": read_by_send
}
if isinstance(message, str):
message = TextContent(message)
if quick_reply:
Expand Down Expand Up @@ -151,4 +154,4 @@ def __init__(self, ids, display_type='single', **kwargs):
self.options = {
'ids': ids,
'displayType': display_type
}
}
hwonyo marked this conversation as resolved.
Show resolved Hide resolved