|
|
|
@ -191,15 +191,18 @@ class Bot(telebot.TeleBot):
|
|
|
|
|
for community_data in self.db.communities.find(): |
|
|
|
|
yield Community.from_dict(community_data) |
|
|
|
|
|
|
|
|
|
def poll_user_for_community(self, user: User, community: Community): |
|
|
|
|
def_answer = community.default_answers.get(user.user_id, True) |
|
|
|
|
self.send_template(user.user_id, 'poll_user', community=community, answer=def_answer) |
|
|
|
|
community.pool += [user.user_id] * def_answer |
|
|
|
|
community.polled[user.user_id] = datetime.date.today() |
|
|
|
|
|
|
|
|
|
def poll_users_in_community(self, community: Community): |
|
|
|
|
for user_id in community.users_to_poll(): |
|
|
|
|
user = User.by_id(user_id, self) |
|
|
|
|
if user is None: |
|
|
|
|
continue |
|
|
|
|
def_answer = community.default_answers.get(user_id, True) |
|
|
|
|
self.send_template(user_id, 'poll_user', community=community, answer=def_answer) |
|
|
|
|
community.pool += [user_id] * def_answer |
|
|
|
|
community.polled[user_id] = datetime.date.today() |
|
|
|
|
self.poll_user_for_community(user, community) |
|
|
|
|
self.save_community(community) |
|
|
|
|
|
|
|
|
|
def send_meeting_info_in_community(self, community: Community): |
|
|
|
|