|
|
@ -70,6 +70,12 @@ class Community: |
|
|
|
Thread(target=upd_data).start() |
|
|
|
Thread(target=upd_data).start() |
|
|
|
return data |
|
|
|
return data |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def can_user_request_a_meeting(self, user_id: int) -> bool: |
|
|
|
|
|
|
|
# Check if there isn't a meeting in archived_meetings with its scheduling date today or yesterday |
|
|
|
|
|
|
|
return not any( |
|
|
|
|
|
|
|
r in [date.today(), date.today() - timedelta(days=1)] and user_id in [l, m] |
|
|
|
|
|
|
|
for l, m, r in self.scheduled_meetings + self.archived_meetings) |
|
|
|
|
|
|
|
|
|
|
|
def add_member(self, user_id: int, bot: Bot) -> bool: |
|
|
|
def add_member(self, user_id: int, bot: Bot) -> bool: |
|
|
|
chat_member_info: ChatMember = bot.get_chat_member(self.chat_id, user_id) |
|
|
|
chat_member_info: ChatMember = bot.get_chat_member(self.chat_id, user_id) |
|
|
|
if chat_member_info.is_member or chat_member_info.status in ['creator', 'administrator', 'admin', 'member']: |
|
|
|
if chat_member_info.is_member or chat_member_info.status in ['creator', 'administrator', 'admin', 'member']: |
|
|
@ -81,7 +87,8 @@ class Community: |
|
|
|
def users_to_poll(self) -> typing.List[int]: |
|
|
|
def users_to_poll(self) -> typing.List[int]: |
|
|
|
return [ |
|
|
|
return [ |
|
|
|
user_id for user_id in self.members |
|
|
|
user_id for user_id in self.members |
|
|
|
if user_id not in self.polled or self.polled[user_id] <= date.today() - timedelta(days=7) |
|
|
|
if (user_id not in self.polled or self.polled[user_id] <= date.today() - timedelta(days=7)) |
|
|
|
|
|
|
|
and self.can_user_request_a_meeting(user_id) |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
def add_answer(self, user_id: typing.Union[int, bool], answer: bool, bot: Bot): |
|
|
|
def add_answer(self, user_id: typing.Union[int, bool], answer: bool, bot: Bot): |
|
|
|