Fix various documentation mistakes

This commit is contained in:
Mads Marquart
2020-03-11 15:00:50 +01:00
parent c27f599e37
commit 89c6af516c
11 changed files with 23 additions and 19 deletions

View File

@@ -4,5 +4,8 @@ Exceptions
.. autoexception:: FacebookError()
.. autoexception:: HTTPError()
.. autoexception:: ParseError()
.. autoexception:: NotLoggedIn()
.. autoexception:: ExternalError()
.. autoexception:: GraphQLError()
.. autoexception:: InvalidParameters()
.. autoexception:: PleaseRefresh()

View File

@@ -1,3 +1,4 @@
.. highlight:: sh
.. See README.rst for explanation of these markers
.. include:: ../README.rst

View File

@@ -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 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.
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!
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
message = user.send_text("test message")
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
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
thread.set_color("#0084ff")

View File

@@ -33,10 +33,10 @@ class Client:
But does not include deactivated, deleted or memorialized users (logically,
since you can't chat with those).
The order these are returned is arbitary.
The order these are returned is arbitrary.
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[0].name
@@ -211,7 +211,7 @@ class Client:
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.
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:
query: Text to search for

View File

@@ -364,7 +364,7 @@ class Listener:
The `Listener` object should not be used after this is called!
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():
... if isinstance(event, fbchat.MessageEvent):
@@ -374,7 +374,7 @@ class Listener:
self._mqtt.disconnect()
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!
payload = _util.json_minimal({"foreground": value})
info = self._mqtt.publish("/foreground_state", payload=payload, qos=1)
@@ -383,7 +383,7 @@ class Listener:
# info.wait_for_publish()
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: Is this the right request to make?
data = {"make_user_available_when_in_foreground": value}

View File

@@ -24,7 +24,7 @@ class ThreadLocation(enum.Enum):
class ActiveStatus:
#: Whether the user is active now
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])
#: Whether the user is playing Messenger game now
in_game = attr.ib(None, type=Optional[bool])

View File

@@ -39,7 +39,7 @@ class AudioAttachment(Attachment):
filename = attr.ib(None, type=Optional[str])
#: URL of the audio file
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])
#: Audio type
audio_type = attr.ib(None, type=Optional[str])
@@ -118,7 +118,7 @@ class VideoAttachment(Attachment):
width = attr.ib(None, type=Optional[int])
#: Height of original video
height = attr.ib(None, type=Optional[int])
#: Length of video as a timedelta
#: Length of video
duration = attr.ib(None, type=Optional[datetime.timedelta])
#: URL to very compressed preview video
preview_url = attr.ib(None, type=Optional[str])

View File

@@ -55,7 +55,7 @@ class LiveLocationAttachment(LocationAttachment):
#: Name of the location
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])
#: True if live location is expired
is_expired = attr.ib(None, type=Optional[bool])

View File

@@ -224,7 +224,7 @@ class MessageSnippet(Message):
#: ID of the sender
author = attr.ib(type=str)
#: Datetime of when the message was sent
#: When the message was sent
created_at = attr.ib(type=datetime.datetime)
#: The actual message
text = attr.ib(type=str)
@@ -252,7 +252,7 @@ class MessageData(Message):
#: ID of the sender
author = attr.ib(type=str)
#: Datetime of when the message was sent
#: When the message was sent
created_at = attr.ib(type=datetime.datetime)
#: The actual message
text = attr.ib(None, type=Optional[str])
@@ -262,7 +262,7 @@ class MessageData(Message):
emoji_size = attr.ib(None, type=Optional[EmojiSize])
#: Whether the message is read
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)
#: A dictionary with user's IDs as keys, and their reaction as values
reactions = attr.ib(factory=dict, type=Mapping[str, str])

View File

@@ -319,7 +319,7 @@ class ThreadABC(metaclass=abc.ABCMeta):
Warning! If someone send a message to the thread that matches the query, while
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.

View File

@@ -114,7 +114,7 @@ class UserData(User):
first_name = attr.ib(type=str)
#: The users last name
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])
#: Number of messages in the thread
message_count = attr.ib(None, type=Optional[int])