From ce67012744574a192d21601f21a6d398a58a5c7b Mon Sep 17 00:00:00 2001 From: lemoer Date: Sat, 21 Dec 2024 00:40:08 +0100 Subject: [PATCH] main: sync group members between two groups --- main.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index a3983ec..7b10c29 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import time import requests import json from result import Result, Ok, Err, is_err @@ -199,6 +200,20 @@ if __name__ == "__main__": #print(receive_messages) bot = LabCleaningBot(api, "group.bm5KT3NJUW5FdkpRNnR2ZGRFa01oOVZBeUYrVkdnd3NNTzFpNWdsR2pwUT0=") - print(bot.get_other_members()) - #asyncio.run(api.receive_test()) \ No newline at end of file + while True: + groupinfo = bot.api.get_group(bot.base_group) + + if is_err(groupinfo): + print(groupinfo.unwrap_err()) + continue + + groupinfo = groupinfo.unwrap() + + res = bot.api.update_group_members("group.TTlKelhpUW1sUVJSU2Z2NDJpdjVWcllMTW93MTBNN2tseEtGaFkzQ1VsZz0=", groupinfo.members) + + if is_err(res): + print(res.unwrap_err()) + continue + + print(res.unwrap())