From 0981be42b968a374ca744ad44246fe5a56d5018f Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Wed, 6 May 2020 11:32:22 +0200 Subject: [PATCH] Fix errors in examples --- examples/fetch.py | 2 +- examples/keepbot.py | 2 +- examples/removebot.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/fetch.py b/examples/fetch.py index e4f4987..f4675b5 100644 --- a/examples/fetch.py +++ b/examples/fetch.py @@ -65,5 +65,5 @@ print("thread's name: {}".format(thread.name)) images = list(thread.fetch_images(limit=20)) for image in images: if isinstance(image, fbchat.ImageAttachment): - url = c.fetch_image_url(image.id) + url = client.fetch_image_url(image.id) print(url) diff --git a/examples/keepbot.py b/examples/keepbot.py index e52e56f..b9fd4e6 100644 --- a/examples/keepbot.py +++ b/examples/keepbot.py @@ -80,7 +80,7 @@ def on_person_removed(sender, event: fbchat.PersonRemoved): return if event.author.id != session.user.id: print(f"{event.removed.id} got removed. They will be re-added") - event.thread.add_participants([removed.id]) + event.thread.add_participants([event.removed.id]) # Login, and start listening for events diff --git a/examples/removebot.py b/examples/removebot.py index a46d426..d31c344 100644 --- a/examples/removebot.py +++ b/examples/removebot.py @@ -5,7 +5,7 @@ def on_message(event): # We can only kick people from group chats, so no need to try if it's a user chat if not isinstance(event.thread, fbchat.Group): return - if message.text == "Remove me!": + if event.message.text == "Remove me!": print(f"{event.author.id} will be removed from {event.thread.id}") event.thread.remove_participant(event.author.id)