Untitled
unknown
python
3 years ago
2.0 kB
20
Indexable
@dp.message() async def upds_funct(update: types.Update): #join in group if (hasattr(update, "new_chat_participant") and update.new_chat_member['id'] == int(config['telegram']['bot_id'])): logger.info("Бот добавлен в группу id: " + str(update.chat.id) + " Название: " + update.chat.title) buttons = ( InlineKeyboardButton(text="-1", callback_data="num_decr"), InlineKeyboardButton(text="+1", callback_data="num_incr"), InlineKeyboardButton(text="Подтвердить", callback_data="num_finish") ) # Благодаря row_width=2, в первом ряду будет две кнопки, а оставшаяся одна # уйдёт на следующую строку keyboard = InlineKeyboardMarkup(buttons) await bot.send_message(adm_id, "Бот добавлен в группу\n id: " + str(update.chat.id) + "\nНазвание: " + update.chat.title + "\nНеобходимо сопоставить с клиентом", reply_markup=keyboard) if(request_api("itpbot/join_group", {'id_group':update.chat.id, 'id_partner':36}, "POST") != False): logger.info("Группа " + str(update.chat.id) + " Название: " + update.chat.title + "сопоставлена с клиентом ") else: await bot.send_message(adm_id, "Ошибка 500") #left in group if (hasattr(update, "left_chat_participant") and update.left_chat_participant['id'] == int(config['telegram']['bot_id'])): logger.info("Бот исключен из группы id: " + str(update.chat.id) + " Название: " + update.chat.title) #удалить информацию из базы await bot.send_message(adm_id, "Бот исключен из группы\n id: " + str(update.chat.id) + "\nНазвание: " + update.chat.title) #await bot.send_message(adm_id, str(update))
Editor is loading...