Skip to content

Commit 97fb971

Browse files
committed
Add auto accept
1 parent 666152a commit 97fb971

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

run.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ def onMessage(self, message_object, author_id, thread_id, thread_type, **kwargs)
2323
mentions = [Mention(uid, 0, len(MENTION)) for uid in group.participants]
2424
self.send(Message(text=MENTION, mentions=mentions), thread_id=thread_id, thread_type=thread_type)
2525

26+
@d_if(AUTO_ACCEPT)
27+
def onInbox(self, **kwargs):
28+
self.acceptPending()
29+
30+
def acceptPending(self):
31+
thread_ids = []
32+
thread_ids += [thread.uid for thread in self.fetchThreadList(thread_location=ThreadLocation.PENDING, limit=20)
33+
if thread.type == ThreadType.GROUP]
34+
thread_ids += [thread.uid for thread in self.fetchThreadList(thread_location=ThreadLocation.OTHER, limit=20)
35+
if thread.type == ThreadType.GROUP]
36+
self.moveThreads(ThreadLocation.INBOX, thread_ids)
37+
2638

2739
if __name__ == "__main__":
2840
client = Client(EMAIL, PASSWORD)

0 commit comments

Comments
 (0)