mirror of
				https://github.com/civsocit/olgram.git
				synced 2025-10-30 00:43:25 +00:00 
			
		
		
		
	fix chats
This commit is contained in:
		
							parent
							
								
									2555d155a0
								
							
						
					
					
						commit
						e4827132ee
					
				|  | @ -47,9 +47,9 @@ async def select_chat(bot: Bot, call: types.CallbackQuery, chat: str): | |||
|         return | ||||
| 
 | ||||
|     chat_obj = await bot.group_chats.filter(id=chat).first() | ||||
|     if not chat: | ||||
|     if not chat_obj: | ||||
|         await call.answer("Нельзя привязать бота к этому чату") | ||||
|         return | ||||
|     bot.group_chat = chat | ||||
|     bot.group_chat = chat_obj | ||||
|     await bot.save() | ||||
|     await call.answer(f"Выбран чат {chat_obj.name}") | ||||
|  |  | |||
|  | @ -48,12 +48,15 @@ async def message_handler(message, *args, **kwargs): | |||
|             if not chat_id: | ||||
|                 chat_id = message.reply_to_message.forward_from_chat | ||||
|                 if not chat_id: | ||||
|                     return SendMessage(chat_id=message.chat.id, text="Невозможно переслать сообщение: автор не найден") | ||||
|                     return SendMessage(chat_id=message.chat.id, | ||||
|                                        text="__Невозможно переслать сообщение: автор не найден__", | ||||
|                                        parse_mode="Markdown") | ||||
|             chat_id = int(chat_id) | ||||
|             try: | ||||
|                 await message.copy_to(chat_id) | ||||
|             except (exceptions.MessageError, exceptions.BotBlocked): | ||||
|                 await message.reply("Невозможно переслать сообщение: возможно, автор заблокировал бота") | ||||
|                 await message.reply("__Невозможно переслать сообщение (автор заблокировал бота?)__", | ||||
|                                     parse_mode="Markdown") | ||||
|                 return | ||||
|         else: | ||||
|             await message.forward(super_chat_id) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user