|
|
@ -28,14 +28,19 @@ def views(bot: Bot): |
|
|
|
|
|
|
|
|
|
|
|
@bot.handle_commands(['/request', '📝 Request a meeting', '📝 Запросить встречу']) |
|
|
|
@bot.handle_commands(['/request', '📝 Request a meeting', '📝 Запросить встречу']) |
|
|
|
def request_meeting(msg, user, _args): |
|
|
|
def request_meeting(msg, user, _args): |
|
|
|
# todo: don't allow this command in chats |
|
|
|
if msg.chat.type != 'private': |
|
|
|
comm_ids_and_names = [(community.chat_id, community.name) for community in user.communities] |
|
|
|
bot.reply_with_template(msg, 'err_not_private') |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
comm_ids_and_names = [(community.chat_id, community.name) for community in user.get_communities(bot)] |
|
|
|
bot.reply_with_template(msg, 'request_meeting', comm_list=comm_ids_and_names) |
|
|
|
bot.reply_with_template(msg, 'request_meeting', comm_list=comm_ids_and_names) |
|
|
|
|
|
|
|
|
|
|
|
@bot.handle_commands(['/join']) |
|
|
|
@bot.handle_commands(['/join']) |
|
|
|
def join_community(msg, user, args): |
|
|
|
def join_community(msg, user, args): |
|
|
|
|
|
|
|
# check if it really is a community |
|
|
|
|
|
|
|
if msg.chat.type == 'private': |
|
|
|
|
|
|
|
bot.reply_with_template(msg, 'err_not_community') |
|
|
|
|
|
|
|
return |
|
|
|
# send community link |
|
|
|
# send community link |
|
|
|
# todo: check if it really is a community |
|
|
|
|
|
|
|
community = Community.by_id(msg.chat.id, bot) |
|
|
|
community = Community.by_id(msg.chat.id, bot) |
|
|
|
bot.reply_with_template(msg, 'welcome', community=community, join=True) |
|
|
|
bot.reply_with_template(msg, 'welcome', community=community, join=True) |
|
|
|
|
|
|
|
|
|
|
|