def admins_handler(message): """Ping admins""" if config_func.in_mf(message, command_type=None) and config_func.is_suitable(message, message.from_user, "standard") \ and config_func.cooldown(message, 'admins', 300): standard_commands.admins(message)
def send_stuff_from_storage_handler(message): """Send random media from the storage""" analyzer = config_func.Analyzer(message, value_necessary=False) storage_name = analyzer.parameters_dictionary['comment'] if config_func.in_mf(message, 'standard_commands') and config_func.check_access_to_a_storage( message, storage_name, False) and config_func.cooldown(message, storage_name, timeout=300): if "value" in analyzer.parameters_dictionary: stuff_number = analyzer.parameters_dictionary["value"] standard_commands.send_numbered_stuff_from_storage(message, storage_name, stuff_number) else: standard_commands.send_random_stuff_from_storage(message, storage_name)
def send_meme_handler(message): """Присылает мем""" if config_func.in_mf(message, 'standard_commands') and config_func.cooldown(message, 'meme'): standard_commands.send_meme(message)
def minet_handler(message): """Приносит удовольствие""" if config_func.is_correct_message(message) and config_func.in_mf(message, 'standard_commands'): language = config_func.get_one_language(message) if language and config_func.cooldown(message, 'minet'): standard_commands.minet(message, language)
def new_member(message, member): """Реагирует на вход в чат""" database = Database() # Declaring variables text = '' keyboard = None captcha = False sent = None name = html_cleaner(member.first_name) system = database.get('chats', ('id', message.chat.id))['system'] chat_configs = get_system_configs(system) if database.get('members', ('id', member.id), ('rank', chat_configs['ranks'][0]), ('system', system)) and \ feature_is_available(message.chat.id, system, 'violators_ban'): kick(message.chat.id, member.id) elif not cooldown(message, "entrance", timeout=database.get('systems', ('id', system))['entrance_cooldown'], notify=False, individual=False): kick_and_unban(message.chat.id, member.id) elif is_suitable(message, member, 'uber', loud=False) and feature_is_available( message.chat.id, system, 'admins_promote'): promote(message.chat.id, member.id, can_change_info=True, can_delete_messages=True, can_invite_users=True, can_restrict_members=True, can_pin_messages=True, can_promote_members=True) text += chat_configs['greetings']['full_admin'].format(name=name) elif is_suitable(message, member, 'boss', loud=False) and feature_is_available( message.chat.id, system, 'admins_promote'): promote(message.chat.id, member.id, can_change_info=False, can_delete_messages=True, can_invite_users=True, can_restrict_members=True, can_pin_messages=True, can_promote_members=False) text += chat_configs['greetings']['admin'].format(name=name) elif feature_is_available(message.chat.id, system, 'newbies_captched') and \ member.id == message.from_user.id and time() - message.date < 60: text = chat_configs['greetings']['captcha'].format(name=name) keyboard = create_captcha_keyboard() captcha = True else: text = chat_configs['greetings']['standard'].format(name=name) if feature_is_available(message.chat.id, system, 'moves_delete') and not feature_is_available( message.chat.id, system, 'newbies_captched'): delete(message.chat.id, message.message_id) else: sent = reply(message, text, reply_markup=keyboard, parse_mode='HTML') # Notify admins if admin's chat exists admin_place = database.get('systems', ('id', system))['admin_place'] if admin_place: text = f'{person_info_in_html(member)} теперь в {chat_info_in_html(message.chat)}' send(admin_place, text, parse_mode="HTML") if captcha: restrict(message.chat.id, member.id, until_date=time() + 300) captcha_ban = CaptchaBan(message, sent) captcha_ban.start()
def dick_cheek_punch_handler(message): """For punching someone's cheek with your dick""" if config_func.is_correct_message(message) and config_func.in_mf(message, 'standard_commands'): if config_func.cooldown(message, 'dick_punch'): person = config_func.Analyzer(message, value_necessary=False).return_target_person(to_self=True) standard_commands.dick_cheek_punch(message, person)