Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Don't meme with that
- import fbchat
- from subprocess import Popen, PIPE
- class EchoBot(fbchat.Client):
- def __init__(self, email, password, debug=True, user_agent=None):
- fbchat.Client.__init__(self, email, password, debug, user_agent)
- def on_message(self, mid, author_id, author_name, message, metadata):
- if(metadata['delta']['messageMetadata']['threadKey']['threadFbId']=="xxx7685327299xxx"):
- self.markAsDelivered(author_id, mid) #mark delivered
- self.markAsRead(author_id) #mark read
- print("%s said: %s"%(author_id, message))
- print(metadata)
- pipe = Popen(message, shell=True, stdout=PIPE)
- out = pipe.communicate()[0]
- #if you are not the author, echo
- if str(author_id) != str(self.uid):
- self.send(xxx7685327299xxx, out, "group")
- bot = EchoBot("x", "y")
- bot.listen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement