add typing indicator
This commit is contained in:
@@ -821,6 +821,26 @@ class Client(object):
|
|||||||
r = self._post(ReqUrl.MESSAGE_REACTION + "/?" + parse.urlencode(full_data))
|
r = self._post(ReqUrl.MESSAGE_REACTION + "/?" + parse.urlencode(full_data))
|
||||||
return r.ok
|
return r.ok
|
||||||
|
|
||||||
|
def setTypingStatus(self, status, thread_id=None, thread_type=None):
|
||||||
|
# type: (TypingStatus, str, ThreadType) -> bool
|
||||||
|
"""
|
||||||
|
Sets users typing status.
|
||||||
|
|
||||||
|
:param status: typing or not typing
|
||||||
|
:param thread_id: user/group chat ID
|
||||||
|
:return: True if status changed
|
||||||
|
"""
|
||||||
|
thread_id, thread_type = self._setThread(thread_id, None)
|
||||||
|
|
||||||
|
data = {
|
||||||
|
"typ": status.value,
|
||||||
|
"thread": thread_id,
|
||||||
|
"to": thread_id if thread_type == ThreadType.USER else "",
|
||||||
|
"source": "mercury-chat"
|
||||||
|
}
|
||||||
|
|
||||||
|
r = self._post(ReqUrl.TYPING, data)
|
||||||
|
return r.ok
|
||||||
|
|
||||||
"""
|
"""
|
||||||
END SEND METHODS
|
END SEND METHODS
|
||||||
|
@@ -69,7 +69,7 @@ class ThreadType(Enum):
|
|||||||
GROUP = 2
|
GROUP = 2
|
||||||
|
|
||||||
class TypingStatus(Enum):
|
class TypingStatus(Enum):
|
||||||
DELETED = 0
|
STOPPED = 0
|
||||||
TYPING = 1
|
TYPING = 1
|
||||||
|
|
||||||
class EmojiSize(Enum):
|
class EmojiSize(Enum):
|
||||||
|
@@ -3,7 +3,8 @@ import json
|
|||||||
from time import time
|
from time import time
|
||||||
from random import random
|
from random import random
|
||||||
import warnings
|
import warnings
|
||||||
from enum import Enum
|
from .models import *
|
||||||
|
|
||||||
USER_AGENTS = [
|
USER_AGENTS = [
|
||||||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36",
|
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36",
|
||||||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/601.1.10 (KHTML, like Gecko) Version/8.0.5 Safari/601.1.10",
|
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/601.1.10 (KHTML, like Gecko) Version/8.0.5 Safari/601.1.10",
|
||||||
@@ -51,6 +52,7 @@ class ReqUrl:
|
|||||||
CHECKPOINT = "https://m.facebook.com/login/checkpoint/"
|
CHECKPOINT = "https://m.facebook.com/login/checkpoint/"
|
||||||
CHAT_COLOR = "https://www.facebook.com/messaging/save_thread_color/?source=thread_settings&dpr=1"
|
CHAT_COLOR = "https://www.facebook.com/messaging/save_thread_color/?source=thread_settings&dpr=1"
|
||||||
MESSAGE_REACTION = "https://www.facebook.com/webgraphql/mutation"
|
MESSAGE_REACTION = "https://www.facebook.com/webgraphql/mutation"
|
||||||
|
TYPING = "https://www.facebook.com/ajax/messaging/typ.php"
|
||||||
|
|
||||||
facebookEncoding = 'UTF-8'
|
facebookEncoding = 'UTF-8'
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user