Remove TypingStatus

This commit is contained in:
Mads Marquart
2020-01-09 20:56:10 +01:00
parent 8b6d9b16c6
commit c81e509eb0
5 changed files with 7 additions and 17 deletions

View File

@@ -55,8 +55,6 @@ Miscellaneous
.. autoclass:: ThreadLocation(Enum) .. autoclass:: ThreadLocation(Enum)
:undoc-members: :undoc-members:
.. autoclass:: ActiveStatus() .. autoclass:: ActiveStatus()
.. autoclass:: TypingStatus(Enum)
:undoc-members:
.. autoclass:: QuickReply .. autoclass:: QuickReply
.. autoclass:: QuickReplyText .. autoclass:: QuickReplyText

View File

@@ -15,7 +15,7 @@ from ._core import Image
from ._exception import FBchatException, FBchatFacebookError from ._exception import FBchatException, FBchatFacebookError
from ._session import Session from ._session import Session
from ._thread import ThreadLocation, ThreadABC, Thread from ._thread import ThreadLocation, ThreadABC, Thread
from ._user import TypingStatus, User, UserData, ActiveStatus from ._user import User, UserData, ActiveStatus
from ._group import Group, GroupData from ._group import Group, GroupData
from ._page import Page, PageData from ._page import Page, PageData
from ._message import EmojiSize, Mention, Message from ._message import EmojiSize, Mention, Message

View File

@@ -7,7 +7,7 @@ from . import _util, _graphql, _session
from ._exception import FBchatException, FBchatFacebookError from ._exception import FBchatException, FBchatFacebookError
from ._thread import ThreadLocation from ._thread import ThreadLocation
from ._user import TypingStatus, User, UserData, ActiveStatus from ._user import User, UserData, ActiveStatus
from ._group import Group, GroupData from ._group import Group, GroupData
from ._page import Page, PageData from ._page import Page, PageData
from ._message import EmojiSize, Mention, Message from ._message import EmojiSize, Mention, Message
@@ -1401,9 +1401,8 @@ class Client:
else: else:
thread_id = author_id thread_id = author_id
thread = User(session=self.session, id=thread_id) thread = User(session=self.session, id=thread_id)
typing_status = TypingStatus(m.get("st"))
self.on_typing( self.on_typing(
author_id=author_id, status=typing_status, thread=thread, author_id=author_id, status=m["st"] == 1, thread=thread
) )
# Delivered # Delivered
@@ -1812,7 +1811,7 @@ class Client:
Args: Args:
author_id: The ID of the person who sent the action author_id: The ID of the person who sent the action
status (TypingStatus): The typing status is_typing: ``True`` if the user started typing, ``False`` if they stopped.
thread: Thread that the action was sent to. See :ref:`intro_threads` thread: Thread that the action was sent to. See :ref:`intro_threads`
""" """
pass pass

View File

@@ -1,5 +1,5 @@
import attr import attr
from ._core import log, attrs_default, Enum, Image from ._core import log, attrs_default, Image
from . import _util, _session, _plan, _thread from . import _util, _session, _plan, _thread
@@ -33,13 +33,6 @@ GENDERS = {
} }
class TypingStatus(Enum):
"""Used to specify whether the user is typing or has stopped typing."""
STOPPED = 0
TYPING = 1
@attrs_default @attrs_default
class User(_thread.ThreadABC): class User(_thread.ThreadABC):
"""Represents a Facebook user. Implements `ThreadABC`.""" """Represents a Facebook user. Implements `ThreadABC`."""

View File

@@ -1,6 +1,6 @@
import pytest import pytest
from fbchat import Message, FBchatFacebookError, TypingStatus from fbchat import Message, FBchatFacebookError
from utils import random_hex, subset from utils import random_hex, subset
from os import path from os import path
@@ -105,7 +105,7 @@ def test_change_color_invalid(client):
client.change_thread_color(InvalidColor()) client.change_thread_color(InvalidColor())
@pytest.mark.parametrize("status", TypingStatus) @pytest.mark.parametrize("status", [True, False])
def test_typing_status(client, catch_event, compare, status): def test_typing_status(client, catch_event, compare, status):
with catch_event("on_typing") as x: with catch_event("on_typing") as x:
client.set_typing_status(status) client.set_typing_status(status)