mirror of
				https://gitflic.ru/project/alt-gnome/karkas.git
				synced 2025-10-31 22:01:21 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			57 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| # flake8: noqa
 | |
| from aiogram import Bot
 | |
| from aiogram.types import Message
 | |
| 
 | |
| from ocab_core.modules_system.public_api import get_module
 | |
| 
 | |
| get_default_chat_tag = get_module("standard.config", "get_default_chat_tag")
 | |
| 
 | |
| 
 | |
| async def delete_message(message: Message, bot: Bot):
 | |
|     reply_message_id = message.reply_to_message.message_id
 | |
|     await bot.delete_message(message.chat.id, reply_message_id)
 | |
| 
 | |
| 
 | |
| async def error_access(message: Message, bot: Bot):
 | |
|     await message.reply("Вы не админ/модератор")
 | |
| 
 | |
| 
 | |
| async def get_chat_id(message: Message, bot: Bot):
 | |
|     await message.reply(
 | |
|         f"ID данного чата: `{message.chat.id}`", parse_mode="MarkdownV2"
 | |
|     )
 | |
| 
 | |
| 
 | |
| async def chat_not_in_approve_list(message: Message, bot: Bot):
 | |
|     await message.reply(
 | |
|         f"Бот недоступен в данном чате, пожалуйста,"
 | |
|         f" обратитесь к администратору для добавления чата в список доступных или перейдите в чат "
 | |
|         f"{get_default_chat_tag()}"
 | |
|     )
 | |
|     await get_chat_id(message, bot)
 | |
| 
 | |
| 
 | |
| async def mute_user(chat_id: int, user_id: int, time: int, bot: Bot):
 | |
|     # *, can_send_messages: bool | None = None, can_send_audios: bool | None = None, can_send_documents: bool | None = None, can_send_photos: bool | None = None, can_send_videos: bool | None = None, can_send_video_notes: bool | None = None, can_send_voice_notes: bool | None = None, can_send_polls: bool | None = None, can_send_other_messages: bool | None = None, can_add_web_page_previews: bool | None = None, can_change_info: bool | None = None, can_invite_users: bool | None = None, can_pin_messages: bool | None = None, can_manage_topics: bool | None = None, **extra_data: Any)
 | |
| 
 | |
|     mutePermissions = {
 | |
|         "can_send_messages": False,
 | |
|         "can_send_audios": False,
 | |
|         "can_send_documents": False,
 | |
|         "can_send_photos": False,
 | |
|         "can_send_videos": False,
 | |
|         "can_send_video_notes": False,
 | |
|         "can_send_voice_notes": False,
 | |
|         "can_send_polls": False,
 | |
|         "can_send_other_messages": False,
 | |
|         "can_add_web_page_previews": False,
 | |
|         "can_change_info": False,
 | |
|         "can_invite_users": False,
 | |
|         "can_pin_messages": False,
 | |
|         "can_manage_topics": False,
 | |
|     }
 | |
|     end_time = time + int(time.time())
 | |
|     await bot.restrict_chat_member(
 | |
|         chat_id, user_id, until_date=end_time, **mutePermissions
 | |
|     )
 |