Fix errors in examples

This commit is contained in:
Mads Marquart
2020-05-06 11:32:22 +02:00
parent af3758c8a9
commit 0981be42b9
3 changed files with 3 additions and 3 deletions

View File

@@ -65,5 +65,5 @@ print("thread's name: {}".format(thread.name))
images = list(thread.fetch_images(limit=20)) images = list(thread.fetch_images(limit=20))
for image in images: for image in images:
if isinstance(image, fbchat.ImageAttachment): if isinstance(image, fbchat.ImageAttachment):
url = c.fetch_image_url(image.id) url = client.fetch_image_url(image.id)
print(url) print(url)

View File

@@ -80,7 +80,7 @@ def on_person_removed(sender, event: fbchat.PersonRemoved):
return return
if event.author.id != session.user.id: if event.author.id != session.user.id:
print(f"{event.removed.id} got removed. They will be re-added") 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 # Login, and start listening for events

View File

@@ -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 # 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): if not isinstance(event.thread, fbchat.Group):
return return
if message.text == "Remove me!": if event.message.text == "Remove me!":
print(f"{event.author.id} will be removed from {event.thread.id}") print(f"{event.author.id} will be removed from {event.thread.id}")
event.thread.remove_participant(event.author.id) event.thread.remove_participant(event.author.id)