Fix various documentation mistakes
This commit is contained in:
@@ -4,5 +4,8 @@ Exceptions
|
|||||||
.. autoexception:: FacebookError()
|
.. autoexception:: FacebookError()
|
||||||
.. autoexception:: HTTPError()
|
.. autoexception:: HTTPError()
|
||||||
.. autoexception:: ParseError()
|
.. autoexception:: ParseError()
|
||||||
|
.. autoexception:: NotLoggedIn()
|
||||||
.. autoexception:: ExternalError()
|
.. autoexception:: ExternalError()
|
||||||
.. autoexception:: GraphQLError()
|
.. autoexception:: GraphQLError()
|
||||||
|
.. autoexception:: InvalidParameters()
|
||||||
|
.. autoexception:: PleaseRefresh()
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
.. highlight:: sh
|
||||||
.. See README.rst for explanation of these markers
|
.. See README.rst for explanation of these markers
|
||||||
|
|
||||||
.. include:: ../README.rst
|
.. include:: ../README.rst
|
||||||
|
@@ -46,7 +46,7 @@ A thread basically just means "something I can chat with", but more precisely, i
|
|||||||
- The conversation between you and a single Facebook user (`User`)
|
- The conversation between you and a single Facebook user (`User`)
|
||||||
- The conversation between you and a Facebook Page (`Page`)
|
- The conversation between you and a Facebook Page (`Page`)
|
||||||
|
|
||||||
You can get your own user ID with `Session.user.id`.
|
You can get your own user ID from `Session.user` with ``session.user.id``.
|
||||||
|
|
||||||
Getting the ID of a specific group thread is fairly trivial, you only need to login to `<https://www.messenger.com/>`_, click on the group you want to find the ID of, and then read the id from the address bar.
|
Getting the ID of a specific group thread is fairly trivial, you only need to login to `<https://www.messenger.com/>`_, click on the group you want to find the ID of, and then read the id from the address bar.
|
||||||
The URL will look something like this: ``https://www.messenger.com/t/1234567890``, where ``1234567890`` would be the ID of the group.
|
The URL will look something like this: ``https://www.messenger.com/t/1234567890``, where ``1234567890`` would be the ID of the group.
|
||||||
@@ -111,19 +111,19 @@ Some functionality, like adding users to a `Group`, or blocking a `User`, logica
|
|||||||
|
|
||||||
With that out of the way, let's see some examples!
|
With that out of the way, let's see some examples!
|
||||||
|
|
||||||
The simplest way of interracting with a thread is by sending a message::
|
The simplest way of interacting with a thread is by sending a message::
|
||||||
|
|
||||||
# Send a message to the user
|
# Send a message to the user
|
||||||
message = user.send_text("test message")
|
message = user.send_text("test message")
|
||||||
|
|
||||||
There are many types of messages you can send, see the full API documentation for more.
|
There are many types of messages you can send, see the full API documentation for more.
|
||||||
|
|
||||||
Notice how we held on to the sent message? The return type i a `Message` instance, so you can interract with it afterwards::
|
Notice how we held on to the sent message? The return type i a `Message` instance, so you can interact with it afterwards::
|
||||||
|
|
||||||
# React to the message with the 😍 emoji
|
# React to the message with the 😍 emoji
|
||||||
message.react("😍")
|
message.react("😍")
|
||||||
|
|
||||||
Besides sending messages, you can also interract with threads in other ways. An example is to change the thread color::
|
Besides sending messages, you can also interact with threads in other ways. An example is to change the thread color::
|
||||||
|
|
||||||
# Will change the thread color to the default blue
|
# Will change the thread color to the default blue
|
||||||
thread.set_color("#0084ff")
|
thread.set_color("#0084ff")
|
||||||
|
@@ -33,10 +33,10 @@ class Client:
|
|||||||
But does not include deactivated, deleted or memorialized users (logically,
|
But does not include deactivated, deleted or memorialized users (logically,
|
||||||
since you can't chat with those).
|
since you can't chat with those).
|
||||||
|
|
||||||
The order these are returned is arbitary.
|
The order these are returned is arbitrary.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
Get the name of an arbitary user that you're currently chatting with.
|
Get the name of an arbitrary user that you're currently chatting with.
|
||||||
|
|
||||||
>>> users = client.fetch_users()
|
>>> users = client.fetch_users()
|
||||||
>>> users[0].name
|
>>> users[0].name
|
||||||
@@ -211,7 +211,7 @@ class Client:
|
|||||||
Warning! If someone send a message to a thread that matches the query, while
|
Warning! If someone send a message to a thread that matches the query, while
|
||||||
we're searching, some snippets will get returned twice, and some will be lost.
|
we're searching, some snippets will get returned twice, and some will be lost.
|
||||||
|
|
||||||
This is fundamentally unfixable, it's just how the endpoint is implemented.
|
This is fundamentally not fixable, it's just how the endpoint is implemented.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
query: Text to search for
|
query: Text to search for
|
||||||
|
@@ -364,7 +364,7 @@ class Listener:
|
|||||||
The `Listener` object should not be used after this is called!
|
The `Listener` object should not be used after this is called!
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
Stop the listener when recieving a message with the text "/stop"
|
Stop the listener when receiving a message with the text "/stop"
|
||||||
|
|
||||||
>>> for event in listener.listen():
|
>>> for event in listener.listen():
|
||||||
... if isinstance(event, fbchat.MessageEvent):
|
... if isinstance(event, fbchat.MessageEvent):
|
||||||
@@ -374,7 +374,7 @@ class Listener:
|
|||||||
self._mqtt.disconnect()
|
self._mqtt.disconnect()
|
||||||
|
|
||||||
def set_foreground(self, value: bool) -> None:
|
def set_foreground(self, value: bool) -> None:
|
||||||
"""Set the `foreground` value while listening."""
|
"""Set the ``foreground`` value while listening."""
|
||||||
# TODO: Document what this actually does!
|
# TODO: Document what this actually does!
|
||||||
payload = _util.json_minimal({"foreground": value})
|
payload = _util.json_minimal({"foreground": value})
|
||||||
info = self._mqtt.publish("/foreground_state", payload=payload, qos=1)
|
info = self._mqtt.publish("/foreground_state", payload=payload, qos=1)
|
||||||
@@ -383,7 +383,7 @@ class Listener:
|
|||||||
# info.wait_for_publish()
|
# info.wait_for_publish()
|
||||||
|
|
||||||
def set_chat_on(self, value: bool) -> None:
|
def set_chat_on(self, value: bool) -> None:
|
||||||
"""Set the `chat_on` value while listening."""
|
"""Set the ``chat_on`` value while listening."""
|
||||||
# TODO: Document what this actually does!
|
# TODO: Document what this actually does!
|
||||||
# TODO: Is this the right request to make?
|
# TODO: Is this the right request to make?
|
||||||
data = {"make_user_available_when_in_foreground": value}
|
data = {"make_user_available_when_in_foreground": value}
|
||||||
|
@@ -24,7 +24,7 @@ class ThreadLocation(enum.Enum):
|
|||||||
class ActiveStatus:
|
class ActiveStatus:
|
||||||
#: Whether the user is active now
|
#: Whether the user is active now
|
||||||
active = attr.ib(type=bool)
|
active = attr.ib(type=bool)
|
||||||
#: Datetime when the user was last active
|
#: When the user was last active
|
||||||
last_active = attr.ib(None, type=Optional[datetime.datetime])
|
last_active = attr.ib(None, type=Optional[datetime.datetime])
|
||||||
#: Whether the user is playing Messenger game now
|
#: Whether the user is playing Messenger game now
|
||||||
in_game = attr.ib(None, type=Optional[bool])
|
in_game = attr.ib(None, type=Optional[bool])
|
||||||
|
@@ -39,7 +39,7 @@ class AudioAttachment(Attachment):
|
|||||||
filename = attr.ib(None, type=Optional[str])
|
filename = attr.ib(None, type=Optional[str])
|
||||||
#: URL of the audio file
|
#: URL of the audio file
|
||||||
url = attr.ib(None, type=Optional[str])
|
url = attr.ib(None, type=Optional[str])
|
||||||
#: Duration of the audio clip as a timedelta
|
#: Duration of the audio clip
|
||||||
duration = attr.ib(None, type=Optional[datetime.timedelta])
|
duration = attr.ib(None, type=Optional[datetime.timedelta])
|
||||||
#: Audio type
|
#: Audio type
|
||||||
audio_type = attr.ib(None, type=Optional[str])
|
audio_type = attr.ib(None, type=Optional[str])
|
||||||
@@ -118,7 +118,7 @@ class VideoAttachment(Attachment):
|
|||||||
width = attr.ib(None, type=Optional[int])
|
width = attr.ib(None, type=Optional[int])
|
||||||
#: Height of original video
|
#: Height of original video
|
||||||
height = attr.ib(None, type=Optional[int])
|
height = attr.ib(None, type=Optional[int])
|
||||||
#: Length of video as a timedelta
|
#: Length of video
|
||||||
duration = attr.ib(None, type=Optional[datetime.timedelta])
|
duration = attr.ib(None, type=Optional[datetime.timedelta])
|
||||||
#: URL to very compressed preview video
|
#: URL to very compressed preview video
|
||||||
preview_url = attr.ib(None, type=Optional[str])
|
preview_url = attr.ib(None, type=Optional[str])
|
||||||
|
@@ -55,7 +55,7 @@ class LiveLocationAttachment(LocationAttachment):
|
|||||||
|
|
||||||
#: Name of the location
|
#: Name of the location
|
||||||
name = attr.ib(None, type=Optional[str])
|
name = attr.ib(None, type=Optional[str])
|
||||||
#: Datetime when live location expires
|
#: When live location expires
|
||||||
expires_at = attr.ib(None, type=Optional[datetime.datetime])
|
expires_at = attr.ib(None, type=Optional[datetime.datetime])
|
||||||
#: True if live location is expired
|
#: True if live location is expired
|
||||||
is_expired = attr.ib(None, type=Optional[bool])
|
is_expired = attr.ib(None, type=Optional[bool])
|
||||||
|
@@ -224,7 +224,7 @@ class MessageSnippet(Message):
|
|||||||
|
|
||||||
#: ID of the sender
|
#: ID of the sender
|
||||||
author = attr.ib(type=str)
|
author = attr.ib(type=str)
|
||||||
#: Datetime of when the message was sent
|
#: When the message was sent
|
||||||
created_at = attr.ib(type=datetime.datetime)
|
created_at = attr.ib(type=datetime.datetime)
|
||||||
#: The actual message
|
#: The actual message
|
||||||
text = attr.ib(type=str)
|
text = attr.ib(type=str)
|
||||||
@@ -252,7 +252,7 @@ class MessageData(Message):
|
|||||||
|
|
||||||
#: ID of the sender
|
#: ID of the sender
|
||||||
author = attr.ib(type=str)
|
author = attr.ib(type=str)
|
||||||
#: Datetime of when the message was sent
|
#: When the message was sent
|
||||||
created_at = attr.ib(type=datetime.datetime)
|
created_at = attr.ib(type=datetime.datetime)
|
||||||
#: The actual message
|
#: The actual message
|
||||||
text = attr.ib(None, type=Optional[str])
|
text = attr.ib(None, type=Optional[str])
|
||||||
@@ -262,7 +262,7 @@ class MessageData(Message):
|
|||||||
emoji_size = attr.ib(None, type=Optional[EmojiSize])
|
emoji_size = attr.ib(None, type=Optional[EmojiSize])
|
||||||
#: Whether the message is read
|
#: Whether the message is read
|
||||||
is_read = attr.ib(None, type=Optional[bool])
|
is_read = attr.ib(None, type=Optional[bool])
|
||||||
#: A list of people IDs who read the message, works only with `Client.fetch_thread_messages`
|
#: People IDs who read the message, only works with `ThreadABC.fetch_messages`
|
||||||
read_by = attr.ib(factory=list, type=bool)
|
read_by = attr.ib(factory=list, type=bool)
|
||||||
#: A dictionary with user's IDs as keys, and their reaction as values
|
#: A dictionary with user's IDs as keys, and their reaction as values
|
||||||
reactions = attr.ib(factory=dict, type=Mapping[str, str])
|
reactions = attr.ib(factory=dict, type=Mapping[str, str])
|
||||||
|
@@ -319,7 +319,7 @@ class ThreadABC(metaclass=abc.ABCMeta):
|
|||||||
Warning! If someone send a message to the thread that matches the query, while
|
Warning! If someone send a message to the thread that matches the query, while
|
||||||
we're searching, some snippets will get returned twice.
|
we're searching, some snippets will get returned twice.
|
||||||
|
|
||||||
This is fundamentally unfixable, it's just how the endpoint is implemented.
|
This is fundamentally not fixable, it's just how the endpoint is implemented.
|
||||||
|
|
||||||
The returned message snippets are ordered by last sent first.
|
The returned message snippets are ordered by last sent first.
|
||||||
|
|
||||||
|
@@ -114,7 +114,7 @@ class UserData(User):
|
|||||||
first_name = attr.ib(type=str)
|
first_name = attr.ib(type=str)
|
||||||
#: The users last name
|
#: The users last name
|
||||||
last_name = attr.ib(None, type=Optional[str])
|
last_name = attr.ib(None, type=Optional[str])
|
||||||
#: Datetime when the thread was last active / when the last message was sent
|
#: When the thread was last active / when the last message was sent
|
||||||
last_active = attr.ib(None, type=Optional[datetime.datetime])
|
last_active = attr.ib(None, type=Optional[datetime.datetime])
|
||||||
#: Number of messages in the thread
|
#: Number of messages in the thread
|
||||||
message_count = attr.ib(None, type=Optional[int])
|
message_count = attr.ib(None, type=Optional[int])
|
||||||
|
Reference in New Issue
Block a user