|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
from datetime import date |
|
|
|
|
|
|
|
|
|
from bot import Bot |
|
|
|
|
from community import Community |
|
|
|
|
|
|
|
|
@ -17,11 +19,11 @@ def views(bot: Bot):
|
|
|
|
|
bot.reply_with_template(msg, 'community_added', community=community, already_member=False) |
|
|
|
|
else: |
|
|
|
|
bot.reply_with_template(msg, 'err_not_a_member', community=community) |
|
|
|
|
bot.reply_with_template(msg, 'start') |
|
|
|
|
bot.reply_with_template(msg, 'info', start=True) |
|
|
|
|
|
|
|
|
|
@bot.handle_commands(['/help', 'ℹ️ About', 'ℹ️ О боте']) |
|
|
|
|
def handle_help(msg, _user, _args): |
|
|
|
|
bot.reply_with_template(msg, 'help') |
|
|
|
|
bot.reply_with_template(msg, 'info', start=False) |
|
|
|
|
|
|
|
|
|
@bot.handle_commands(['/request', '📝 Request a meeting', '📝 Запросить встречу']) |
|
|
|
|
def request_meeting(msg, user, _args): |
|
|
|
@ -32,7 +34,8 @@ def views(bot: Bot):
|
|
|
|
|
def request_meeting_callback(msg, user, args): |
|
|
|
|
community = Community.by_id(int(args), bot) |
|
|
|
|
if community.can_user_request_a_meeting(user.user_id): |
|
|
|
|
# todo: request the meeting and write the template |
|
|
|
|
community.polled[user.user_id] = date.today() |
|
|
|
|
community.pool.append(user.user_id) |
|
|
|
|
bot.reply_with_template(msg, 'request_meeting_success', community=community) |
|
|
|
|
else: |
|
|
|
|
bot.reply_with_template(msg, 'request_meeting_failure', community=community) |
|
|
|
|