diff --git a/main.py b/main.py index f2c4c87..778d053 100644 --- a/main.py +++ b/main.py @@ -442,6 +442,7 @@ If due to any reason you can not participate, please just change your "👍" rea unfulfillable_tasks = [] while True: + self.assert_is_base_group_admin() sync_result = self.sync_members_as_active_users(session) @@ -498,11 +499,24 @@ You have time to answer for {format_seconds(task.timeout)}.""" await asyncio.sleep(1) + def assert_is_base_group_admin(self): + group_info_result = self.api.get_group(self.base_group) + + if is_err(group_info_result): + print("Error, could not get info about base_group " + self.base_group + ": " + group_info_result.unwrap_err()) + exit(1) + + group_info = group_info_result.unwrap() + if config.number not in group_info.admins: + print("Error: Bot is not an admin of the base group.") + exit(1) + async def main(config: Config, session: Session): api = SignalAPI(config.apiurl, config.number) bot = LabCleaningBot(api, config.lab_cleaning_signal_base_group) + bot.assert_is_base_group_admin() await asyncio.gather( bot.receiver(session),