Make Client.session attribute public
This commit is contained in:
@@ -9,7 +9,7 @@ class EchoBot(fbchat.Client):
|
||||
print("{} from {} in {}".format(message_object, thread_id, thread_type.name))
|
||||
|
||||
# If you're not the author, echo
|
||||
if author_id != session.user_id:
|
||||
if author_id != self.session.user_id:
|
||||
self.send(message_object, thread_id=thread_id, thread_type=thread_type)
|
||||
|
||||
|
||||
|
@@ -31,7 +31,7 @@ class KeepBot(fbchat.Client):
|
||||
self.change_thread_emoji(old_emoji, thread_id=thread_id)
|
||||
|
||||
def on_people_added(self, added_ids, author_id, thread_id, **kwargs):
|
||||
if old_thread_id == thread_id and author_id != session.user_id:
|
||||
if old_thread_id == thread_id and author_id != self.session.user_id:
|
||||
print("{} got added. They will be removed".format(added_ids))
|
||||
for added_id in added_ids:
|
||||
self.remove_user_from_group(added_id, thread_id=thread_id)
|
||||
@@ -40,8 +40,8 @@ class KeepBot(fbchat.Client):
|
||||
# No point in trying to add ourself
|
||||
if (
|
||||
old_thread_id == thread_id
|
||||
and removed_id != session.user_id
|
||||
and author_id != session.user_id
|
||||
and removed_id != self.session.user_id
|
||||
and author_id != self.session.user_id
|
||||
):
|
||||
print("{} got removed. They will be re-added".format(removed_id))
|
||||
self.add_users_to_group(removed_id, thread_id=thread_id)
|
||||
|
Reference in New Issue
Block a user