Skip to content

Commit

Permalink
Add auto accept
Browse files Browse the repository at this point in the history
  • Loading branch information
kapi2289 committed Jan 16, 2019
1 parent 666152a commit 97fb971
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ def onMessage(self, message_object, author_id, thread_id, thread_type, **kwargs)
mentions = [Mention(uid, 0, len(MENTION)) for uid in group.participants]
self.send(Message(text=MENTION, mentions=mentions), thread_id=thread_id, thread_type=thread_type)

@d_if(AUTO_ACCEPT)
def onInbox(self, **kwargs):
self.acceptPending()

def acceptPending(self):
thread_ids = []
thread_ids += [thread.uid for thread in self.fetchThreadList(thread_location=ThreadLocation.PENDING, limit=20)
if thread.type == ThreadType.GROUP]
thread_ids += [thread.uid for thread in self.fetchThreadList(thread_location=ThreadLocation.OTHER, limit=20)
if thread.type == ThreadType.GROUP]
self.moveThreads(ThreadLocation.INBOX, thread_ids)


if __name__ == "__main__":
client = Client(EMAIL, PASSWORD)
Expand Down

0 comments on commit 97fb971

Please sign in to comment.