def init(update,context): chat = chat_object(update) get_group = GroupRepository().getById(chat.id) max_warn = get_group['max_warn'] current_time = datetime.datetime.utcnow().isoformat() default_warn = 1 languages(update,context) if update.message.reply_to_message: reason = update.message.text[5:] user = user_reply_object(update) get_user = UserRepository().getUserByGroup([user.id,chat.id]) warn_count = get_user['warn_count'] if get_user is not None else 0 if warn_count != max_warn: buttons = [] buttons.append(InlineKeyboardButton('➖ 1', callback_data='downWarn')) buttons.append(InlineKeyboardButton('➕ 1', callback_data='upWarn')) buttons.append(InlineKeyboardButton(languages.button_remove, callback_data='removeWarn')) menu = build_menu(buttons,3) if get_user: default_warn_count = 0 username = "******"+user.username data = [(username,current_time,user.id)] UserRepository().update(data) data_mtm = [(user.id, chat.id, default_warn_count)] UserRepository().add_into_mtm(data_mtm) data_warn = [(user.id,chat.id)] UserRepository().updateWarn(data_warn) if reason: msg = languages.warn_with_reason.format(mention_html(user.id, user.first_name),chat.title,chat.id,reason) update.message.reply_to_message.reply_text(msg, reply_markup=InlineKeyboardMarkup(menu),parse_mode='HTML') else: msg = languages.warn_user.format(mention_html(user.id, user.first_name),chat.title,chat.id) update.message.reply_to_message.reply_text(msg, reply_markup=InlineKeyboardMarkup(menu),parse_mode='HTML') log_txt = "‼️ #Log {} was warned\nin the group: {} <code>[{}]</code>".format(mention_html(user.id, user.first_name),chat.title,chat.id) if reason: log_txt = "‼️ #Log {} was warned\nin the group: {} <code>[{}]</code>\nReason: {}".format(mention_html(user.id, user.first_name),chat.title,chat.id,reason) telegram_loggers(update,context,log_txt) else: username = "******"+user.username data = [(user.id,username,current_time,current_time)] UserRepository().add(data) data_mtm = [(user.id, chat.id, default_warn)] UserRepository().add_into_mtm(data_mtm) if reason: message(update,context,languages.warn_with_reason.format(username,chat.title,chat.id,reason)) else: message(update,context,languages.warn_user.format(username,chat.title,chat.id)) log_txt = "‼️ #Log {} was warned\nin the group: {} <code>[{}]</code>".format(mention_html(user.id, user.first_name),chat.title,chat.id) if reason: log_txt = "‼️ #Log {} was warned\nin the group: {} <code>[{}]</code>\nReason: {}".format(mention_html(user.id, user.first_name),chat.title,chat.id,reason) telegram_loggers(update,context,log_txt) else: ban_user_reply(update,context) buttons = [] buttons.append(InlineKeyboardButton('Remove', callback_data='removeWarn')) menu = build_menu(buttons,2) msg = languages.warn_user_max.format(user.username,chat.title) update.message.reply_to_message.reply_text(msg, reply_markup=InlineKeyboardMarkup(menu),parse_mode='HTML') else: message(update,context,languages.error_response_user_msg)
def init(update, context): if update.message.reply_to_message: user = user_reply_object(update) row = SuperbanRepository().getWhitelistById(user.id) get_superban = SuperbanRepository().getById(user.id) if get_superban: buttons = [] buttons.append( InlineKeyboardButton('Remove Superban', callback_data='removeBL')) buttons.append( InlineKeyboardButton('Close', callback_data='closed')) menu = build_menu(buttons, 2) msg = "Attention the user is blacklisted! do you want to remove it?" update.message.reply_to_message.reply_text( msg, reply_markup=InlineKeyboardMarkup(menu), parse_mode='HTML') else: if row: message(update, context, "You have already whitelisted this user") else: user_username = "******" + user.username data = [(user.id, user_username)] SuperbanRepository().addWhitelist(data) message( update, context, "You have entered the user {} in the Whitelist".format( user_username)) else: message(update, context, "This message can only be used in response to a user")
def keyboard_settings(update,context,editkeyboard = False): bot = context.bot chat = update.message.chat_id chat_title = update.message.chat.title group = GroupRepository().getById(chat) list_buttons = [] list_buttons.append(InlineKeyboardButton('%s Welcome 👋🏻' % ('✅' if group['set_welcome'] == 1 else '❌'), callback_data='setWelcome')) list_buttons.append(InlineKeyboardButton('%s Silence 🤫' % ('✅' if group['set_silence'] == 1 else '❌'), callback_data='setSilence')) list_buttons.append(InlineKeyboardButton('%s Deny All Entry 🚷' % ('✅' if group['block_new_member'] == 1 else '❌'), callback_data='setBlockEntry')) list_buttons.append(InlineKeyboardButton('%s AntiFlood 🚫' % ('✅' if group['set_antiflood'] == 1 else '❌'), callback_data='setAntiflood')) list_buttons.append(InlineKeyboardButton('%s No User Photo Entry ⛔️' % ('✅' if group['set_user_profile_picture'] == 1 else '❌'), callback_data='userPhoto')) list_buttons.append(InlineKeyboardButton('%s No Arabic Entry ⛔️' % ('✅' if group['set_arabic_filter'] == 1 else '❌'), callback_data='arabic')) list_buttons.append(InlineKeyboardButton('%s No Russian Entry ⛔️' % ('✅' if group['set_cirillic_filter'] == 1 else '❌'), callback_data='cirillic')) list_buttons.append(InlineKeyboardButton('%s No Chinese Entry ⛔️' % ('✅' if group['set_chinese_filter'] == 1 else '❌'), callback_data='chinese')) list_buttons.append(InlineKeyboardButton('%s No ZooPhile Entry ⛔️' % ('✅' if group['zoophile_filter'] == 1 else '❌'), callback_data='zoophile')) list_buttons.append(InlineKeyboardButton('%s Block Vocal ⛔️' % ('✅' if group['set_no_vocal'] == 1 else '❌'), callback_data='novocal')) list_buttons.append(InlineKeyboardButton('%s Block Channel 📢' % ('✅' if group['sender_chat_block'] == 1 else '❌'), callback_data='channelblock')) list_buttons.append(InlineKeyboardButton('%s Block Spoiler 🚫' % ('✅' if group['spoiler_block'] == 1 else '❌'), callback_data='spoilerblock')) list_buttons.append(InlineKeyboardButton('Languages', callback_data='lang')) list_buttons.append(InlineKeyboardButton('Commands', url='https://github.com/Squirrel-Network/nebula8/wiki/Command-List')) list_buttons.append(InlineKeyboardButton('Dashboard', url='https://nebula.squirrel-network.online')) list_buttons.append(InlineKeyboardButton("Close", callback_data='close')) menu = build_menu(list_buttons,2) if editkeyboard == False: keyboard_menu = bot.send_message(chat,"⚙️ Bot settings\n\n📜 Group Name: <i>{}</i>\n🏷 ChatId: <code>{}</code>".format(chat_title,chat),reply_markup=InlineKeyboardMarkup(menu),parse_mode='HTML') if editkeyboard == True: keyboard_menu = bot.edit_message_reply_markup(chat,update.message.message_id,reply_markup=InlineKeyboardMarkup(menu)) return keyboard_menu
def keyboard_filters(update, context, editkeyboard=False): bot = context.bot chat = update.message.chat_id group = GroupRepository().getById(chat) list_buttons = [] list_buttons.append( InlineKeyboardButton('Exe Filters %s' % ('✅' if group['exe_filter'] == 1 else '❌'), callback_data='exe_filters')) list_buttons.append( InlineKeyboardButton('Zip Filters', callback_data='zip_filters')) list_buttons.append( InlineKeyboardButton('TarGZ Filters', callback_data='targz_filters')) list_buttons.append(InlineKeyboardButton("Close", callback_data='close')) menu = build_menu(list_buttons, 2) if editkeyboard == False: keyboard_menu = bot.send_message( chat, "Filters Settings", reply_markup=InlineKeyboardMarkup(menu), parse_mode='HTML') if editkeyboard == True: keyboard_menu = bot.edit_message_reply_markup( chat, update.message.message_id, reply_markup=InlineKeyboardMarkup(menu)) return keyboard_menu
def init(update, context): bot = context.bot chat = chat_object(update) languages(update, context) record_arabic = GroupRepository.SET_ARABIC record_chinese = GroupRepository.SET_CHINESE record_cirillic = GroupRepository.SET_CIRILLIC record_no_user_photo = GroupRepository.SET_USER_PROFILE_PICT record_silence = GroupRepository.SET_SILENCE record_block_channel = GroupRepository.SENDER_CHAT_BLOCK record_zoophile = GroupRepository.ZOOPHILE_FILTER data = [(0, 1, chat.id)] GroupRepository().set_block_entry(data) update_db_settings(update, record_arabic, False) update_db_settings(update, record_chinese, False) update_db_settings(update, record_cirillic, False) update_db_settings(update, record_no_user_photo, False) update_db_settings(update, record_silence, False) update_db_settings(update, record_block_channel, False) update_db_settings(update, record_zoophile, False) buttons = [] buttons.append( InlineKeyboardButton('❌ Remove Shield', callback_data='removeShield')) menu = build_menu(buttons, 1) bot.set_chat_permissions(update.effective_chat.id, PERM_FALSE) bot.send_message(chat.id, languages.shield_on, reply_markup=InlineKeyboardMarkup(menu), parse_mode='HTML') logs_text = '🛡Shield Activated in {} <code>[{}]</code>'.format( chat.title, chat.id) telegram_loggers(update, context, logs_text)
def welcome_user(update, context, member): # Check that the welcome exists on the database if there is no Default Welcome chat = update.effective_message.chat_id group = GroupRepository().getById(chat) if group is not None: parsed_message = group['welcome_text'].replace( '{first_name}', update.message.from_user.first_name).replace( '{chat}', update.message.chat.title).replace('{username}', "@" + member.username) format_message = "{}".format(parsed_message) buttons = GroupRepository().getById(chat) try: welcome_buttons = buttons['welcome_buttons'] format_json = json.loads(welcome_buttons) arr_buttons = [] for key, value in format_json.items(): arr_buttons.append(InlineKeyboardButton(text=key, url=value)) menu = build_menu(arr_buttons, 2) update.message.reply_text(format_message, reply_markup=InlineKeyboardMarkup(menu), parse_mode='HTML') except ValueError: reply_message(update, context, format_message) else: chat_title = update.effective_chat.title default_welcome = Config.DEFAULT_WELCOME.format( "@" + member.username, chat_title) reply_message(update, context, default_welcome)
def init(update, context): bot = context.bot chat = update.effective_message.chat_id languages(update, context) msg = languages.helps.format("@" + bot.username) buttons = [] buttons.append( InlineKeyboardButton( "Commands List", url='https://github.com/Squirrel-Network/nebula8/wiki/Command-List' )) buttons.append( InlineKeyboardButton( "Source", url='https://github.com/Squirrel-Network/nebula8')) buttons.append( InlineKeyboardButton("Logs Channel", url='https://t.me/nebulalogs')) buttons.append( InlineKeyboardButton("News Channel", url='https://t.me/nebulanewsbot')) buttons.append( InlineKeyboardButton("BlackList Search", url='https://squirrel-network.online/knowhere')) buttons.append( InlineKeyboardButton( "Official API Docs", url='https://api.nebula.squirrel-network.online/apidocs')) buttons.append( InlineKeyboardButton("Network SN", url='https://t.me/squirrelnetwork')) menu = build_menu(buttons, 3) bot.send_message(chat, msg, reply_markup=InlineKeyboardMarkup(menu))
def init(update, context): #Variables text = update.message.text operator_id = update.message.from_user.id operator_username = "******" + update.message.from_user.username save_date = datetime.datetime.utcnow().isoformat() #Build a Keyboard Buttons buttons = [] buttons.append(InlineKeyboardButton('Spam', callback_data='mSpam')) buttons.append(InlineKeyboardButton('Scam', callback_data='mScam')) buttons.append(InlineKeyboardButton('Userbot', callback_data='mUserbot')) buttons.append(InlineKeyboardButton('P**n', callback_data='mPorn')) buttons.append(InlineKeyboardButton('Other', callback_data='mOther')) buttons.append( InlineKeyboardButton('Illegal Content', callback_data='mIllegal_Content')) buttons.append( InlineKeyboardButton('Remove Superban', callback_data='removeSuperban')) buttons.append(InlineKeyboardButton('Close', callback_data='closeMenu')) menu = build_menu(buttons, 2) if update.message.reply_to_message: user_id = update.message.reply_to_message.from_user.id update.message.reply_to_message.reply_text( "Select a reason for the Superban", reply_markup=InlineKeyboardMarkup(menu)) else: input_user_id = text[2:].strip().split(" ", 1) user_id = input_user_id[0] if user_id != "": number = re.search(Regex.HAS_NUMBER, user_id) if number is None: message(update, context, "Attention you must enter a number not letters!") else: default_motivation = "Other" data = [(user_id, default_motivation, save_date, operator_id)] SuperbanRepository().add(data) msg = 'You got super banned <a href="tg://user?id={}">{}</a>\nFor the following reason: <b>{}</b>\nGo to: https://squirrel-network.online/knowhere/?q={} to search for blacklisted users'.format( user_id, user_id, default_motivation, user_id) message(update, context, msg) logs_text = Strings.SUPERBAN_LOG.format( user_id, default_motivation, save_date, operator_username, operator_id) messageWithId(update, context, Config.DEFAULT_LOG_CHANNEL, logs_text) formatter = "Superban eseguito da: {}".format(operator_id) sys_loggers("[SUPERBAN_LOGS]", formatter, False, False, True) debug_channel(update, context, "[DEBUG_LOGGER] {}".format(formatter)) else: message( update, context, "Attention you can not superbanned without entering an TELEGRAM ID!" )
def init(update, context): bot = context.bot r = requests.get("https://distrowatch.com/random.php") parsed_html = BeautifulSoup(r.text, features="html.parser") distro_long_name = parsed_html.title.string[17:].lower() distro_name = distro_long_name.split()[0] distro_url = f'https://distrowatch.com/table.php?distribution={distro_name}' distro_message = "Here is a random linux distribution: " button_list = [InlineKeyboardButton("🐧 ▶️ ", url=distro_url)] reply_markup = InlineKeyboardMarkup(build_menu(button_list, n_cols=1)) bot.send_message(update.message.chat_id,text=distro_message,reply_markup=reply_markup,parse_mode='HTML')
def keyboard_settings(update, context, editkeyboard=False): bot = context.bot chat = update.message.chat_id group = GroupRepository().getById(chat) list_buttons = [] list_buttons.append( InlineKeyboardButton('Welcome %s' % ('✅' if group['set_welcome'] == 1 else '❌'), callback_data='setWelcome')) list_buttons.append( InlineKeyboardButton('Silence %s' % ('✅' if group['set_silence'] == 1 else '❌'), callback_data='setSilence')) list_buttons.append( InlineKeyboardButton('Deny All Entry %s' % ('✅' if group['block_new_member'] == 1 else '❌'), callback_data='setBlockEntry')) list_buttons.append( InlineKeyboardButton( 'No User Photo Entry %s' % ('✅' if group['set_user_profile_picture'] == 1 else '❌'), callback_data='userPhoto')) list_buttons.append( InlineKeyboardButton('No Arabic Entry %s' % ('✅' if group['set_arabic_filter'] == 1 else '❌'), callback_data='arabic')) list_buttons.append( InlineKeyboardButton( 'No Russian Entry %s' % ('✅' if group['set_cirillic_filter'] == 1 else '❌'), callback_data='cirillic')) list_buttons.append( InlineKeyboardButton( 'No Chinese Entry %s' % ('✅' if group['set_chinese_filter'] == 1 else '❌'), callback_data='chinese')) list_buttons.append(InlineKeyboardButton('Languages', callback_data='lang')) list_buttons.append( InlineKeyboardButton('Chat Filters', callback_data='Filters')) list_buttons.append(InlineKeyboardButton("Close", callback_data='close')) menu = build_menu(list_buttons, 2) if editkeyboard == False: keyboard_menu = bot.send_message( chat, "Group Settings", reply_markup=InlineKeyboardMarkup(menu), parse_mode='HTML') if editkeyboard == True: keyboard_menu = bot.edit_message_reply_markup( chat, update.message.message_id, reply_markup=InlineKeyboardMarkup(menu)) return keyboard_menu
def keyboard_filters(update, context, editkeyboard=False): bot = context.bot chat = update.message.chat_id chat_title = update.message.chat.title group = GroupRepository().getById(chat) list_buttons = [] list_buttons.append( InlineKeyboardButton('❇️ Activate All', callback_data='ffseall')) list_buttons.append( InlineKeyboardButton('⛔️ Deactivate All', callback_data='ffdeall')) list_buttons.append( InlineKeyboardButton('Exe Filters %s' % ('✅' if group['exe_filter'] == 1 else '❌'), callback_data='ffexe_filters')) list_buttons.append( InlineKeyboardButton('GIF Filters %s' % ('✅' if group['gif_filter'] == 1 else '❌'), callback_data='ffgif_filters')) list_buttons.append( InlineKeyboardButton('Zip Filters %s' % ('✅' if group['zip_filter'] == 1 else '❌'), callback_data='ffzip_filters')) list_buttons.append( InlineKeyboardButton('TarGZ Filters %s' % ('✅' if group['targz_filter'] == 1 else '❌'), callback_data='fftargz_filters')) list_buttons.append( InlineKeyboardButton('JPG Filters %s' % ('✅' if group['jpg_filter'] == 1 else '❌'), callback_data='ffjpg_filters')) list_buttons.append( InlineKeyboardButton('Doc/x Filters %s' % ('✅' if group['docx_filter'] == 1 else '❌'), callback_data='ffdocx_filters')) list_buttons.append( InlineKeyboardButton('Apk Filters %s' % ('✅' if group['apk_filter'] == 1 else '❌'), callback_data='ffapk_filters')) list_buttons.append(InlineKeyboardButton("Close", callback_data='close')) menu = build_menu(list_buttons, 2) if editkeyboard == False: keyboard_menu = bot.send_message( chat, "⚙️ Group Filters Settings\n\n📜 Group Name: <i>{}</i>\n🏷 ChatId: <code>{}</code>" .format(chat_title, chat), reply_markup=InlineKeyboardMarkup(menu), parse_mode='HTML') if editkeyboard == True: keyboard_menu = bot.edit_message_reply_markup( chat, update.message.message_id, reply_markup=InlineKeyboardMarkup(menu)) return keyboard_menu
def init(update, context): languages(update, context) if update.message.reply_to_message: user = update.message.reply_to_message.from_user buttons = [] buttons.append( InlineKeyboardButton(languages.mute_button, callback_data='CMunmute')) buttons.append(InlineKeyboardButton('30Sec', callback_data='CM30')) buttons.append(InlineKeyboardButton('1 Hour', callback_data='CM3600')) buttons.append(InlineKeyboardButton('1 Day', callback_data='CM86400')) buttons.append(InlineKeyboardButton('3 Days', callback_data='CM259200')) buttons.append(InlineKeyboardButton('7 Days', callback_data='CM604800')) buttons.append( InlineKeyboardButton('Forever', callback_data='CMforever')) menu = build_menu(buttons, 2) msg = languages.mute_msg.format(user.id, user.first_name, user.id) update.message.reply_to_message.reply_text( msg, reply_markup=InlineKeyboardMarkup(menu), parse_mode='HTML') mute_user_reply(update, context, True) else: text = update.message.text input_user_id = text[5:].strip().split(" ", 1) user_id = input_user_id[0] time_args = input_user_id[1] if user_id != "" and time_args != "": if user_id.startswith('@'): time_args = input_user_id[1] arg_time = convert_time(update, context, time_args) mute_user_by_username_time(update, context, user_id, arg_time) msg = 'You muted the user {} for <code>{}</code> seconds'.format( user_id, time_args) message(update, context, msg) else: time_args = input_user_id[1] number = re.search(Regex.HAS_NUMBER, user_id) if number is None: message( update, context, "Type a correct telegram id or type in the username!") else: mute_user_by_id_time(update, context, user_id, True, int(time_args)) msg = 'You muted the user <a href="tg://user?id={}">{}</a> <code>[{}]</code> for <code>{}</code> seconds'.format( user_id, user_id, user_id, time_args) message(update, context, msg) else: message( update, context, "Attention you have not entered the user id and mute time correctly" )
def init(update, context): bot = context.bot languages(update, context) chat = update.effective_message.chat_id chat_title = update.message.chat.title list_buttons = [] list_buttons.append( InlineKeyboardButton(languages.rules_button, callback_data='openRules')) menu = build_menu(list_buttons, 1) bot.send_message(chat, languages.rules_main.format(chat_title, chat), reply_markup=InlineKeyboardMarkup(menu), parse_mode='HTML')
def set_warn(update, context): bot = context.bot chat = update.effective_message.chat_id buttons = [] buttons.append(InlineKeyboardButton('2️⃣', callback_data='w2')) buttons.append(InlineKeyboardButton('3️⃣', callback_data='w3')) buttons.append(InlineKeyboardButton('4️⃣', callback_data='w4')) buttons.append(InlineKeyboardButton('5️⃣', callback_data='w5')) buttons.append(InlineKeyboardButton('6️⃣', callback_data='w6')) buttons.append(InlineKeyboardButton('7️⃣', callback_data='w7')) buttons.append(InlineKeyboardButton('8️⃣', callback_data='w8')) buttons.append(InlineKeyboardButton('9️⃣', callback_data='w9')) buttons.append(InlineKeyboardButton('🔟', callback_data='w10')) menu = build_menu(buttons,3) bot.send_message(chat,"⚙️ Warn Settings", reply_markup=InlineKeyboardMarkup(menu),parse_mode='HTML' )
def init(update, context): bot = context.bot chat = update.effective_chat.id list_buttons = [] confs = ConfRepository().getAll() for conf in confs: if conf['switch'] == 1: list_buttons.append( InlineKeyboardButton(text=conf['button_text'], callback_data='save_user')) menu = build_menu(list_buttons, 2) msg = conf['main_text'] bot.send_message(chat, msg, reply_markup=InlineKeyboardMarkup(menu), parse_mode="HTML")
def set_type_no_username(update, context): bot = context.bot chat = update.effective_message.chat_id buttons = [] buttons.append(InlineKeyboardButton('Kick Only', callback_data='tpnu1')) buttons.append(InlineKeyboardButton('Message Only', callback_data='tpnu2')) buttons.append(InlineKeyboardButton('Mute Only', callback_data='tpnu3')) buttons.append(InlineKeyboardButton('Ban Only', callback_data='tpnu4')) buttons.append(InlineKeyboardButton('Silent Kick', callback_data='tpnu5')) buttons.append(InlineKeyboardButton('No action', callback_data='tpnu6')) buttons.append(InlineKeyboardButton('Close', callback_data='closeMenu')) menu = build_menu(buttons, 3) bot.send_message( chat, "No Username Filter Settings\nThe message is always present except for the Silent Kick and No Action", reply_markup=InlineKeyboardMarkup(menu), parse_mode='HTML')
def init(update, context): arg = update.message.text[5:] chat = update.effective_message.chat_id group = GroupRepository().getById(chat) lang = group['languages'] wiki.set_lang(lang.lower()) try: pg = wiki.page(wiki.search(arg)[0]) title = pg.title pg_url = pg.url define = pg.summary button_list = [InlineKeyboardButton("Go to ==>", url=pg_url)] reply_markup = InlineKeyboardMarkup(build_menu(button_list, n_cols=1)) text = "*{}:*\n\n{}".format(title, define) update.message.reply_markdown(text, reply_markup=reply_markup) except: message(update, context, "Sorry {} I didn't find what you were looking for".format(update.message.from_user.first_name))
def duckduckgo(update, context): bot = context.bot msg = str(update.message.text[4:]).strip() if msg != "": main_text = "Here are the results of your DuckDuckGo search" gurl = "https://duckduckgo.com/?q={0}".format(msg.replace(' ', '+')) button_list = [InlineKeyboardButton("🔎 Search", url=gurl)] reply_markup = InlineKeyboardMarkup(build_menu(button_list, n_cols=1)) bot.send_message(update.message.chat_id, text=main_text, reply_markup=reply_markup, parse_mode='HTML') else: message( update, context, text= "You need to type a search criteria!\nHow to use the command: <code>/ddg text</code>" )
def init(update, context): bot = context.bot msg = str(update.message.text[7:]).strip() if msg != "": main_text = "Here are the results of your Google search" gurl = "https://www.google.com/search?&q={0}".format( msg.replace(' ', '+')) button_list = [InlineKeyboardButton("Go to =>", url=gurl)] reply_markup = InlineKeyboardMarkup(build_menu(button_list, n_cols=1)) bot.send_message(update.message.chat_id, text=main_text, reply_markup=reply_markup, parse_mode='HTML') else: message( update, context, text= "You need to type a search criteria!\nHow to use the command: <code>/google text</code>" )
def init(update, context): bot = context.bot staff_group_id = -1001267698171 buttons = [] buttons.append(InlineKeyboardButton('Risolto✅', callback_data='resolved')) menu = build_menu(buttons, 2) if update.effective_message.forward_date is not None: return chat = update.effective_chat languages(update, context) if str(update.effective_message.text).lower().startswith("@admin"): if update.effective_message.reply_to_message: msg = update.effective_message.reply_to_message format_link = "https://t.me/c/{}/{}".format( str(chat.id)[3:], msg.message_id) format_message = Strings.REPORT_MSG.format(chat.id, chat.title, msg.text, format_link) reply_message(update, context, languages.report_msg) telegram_loggers(update, context, format_message) bot.send_message(staff_group_id, format_message, reply_markup=InlineKeyboardMarkup(menu), parse_mode='HTML') else: msg_id = update.effective_message.message_id user_id = update.message.from_user.id user_first = update.message.from_user.first_name format_link = "https://t.me/c/{}/{}".format( str(chat.id)[3:], msg_id) format_message = '#Report\nUser: <a href="tg://user?id={}">{}</a>\nGroup Id: <code>[{}]</code>\nGroup Title: {}\nLink: {}'.format( user_id, user_first, str(chat.id)[3:], chat.title, format_link) reply_message(update, context, languages.report_msg) telegram_loggers(update, context, format_message) bot.send_message(staff_group_id, format_message, reply_markup=InlineKeyboardMarkup(menu), parse_mode='HTML')
def init(update,context): bot = context.bot chat = chat_object(update) if chat.type == 'supergroup': row = CommunityRepository().getById(chat.id) if row: record = GroupRepository.SET_COMMUNITY default_community = 1 data = [(chat.title,chat.id)] data_group = [(default_community, chat.id)] CommunityRepository().update(data) GroupRepository().update_group_settings(record,data_group) message(update,context,"I updated the community on the database") else: buttons = [] buttons.append(InlineKeyboardButton('IT', callback_data='commIT')) buttons.append(InlineKeyboardButton('EN', callback_data='commEN')) buttons.append(InlineKeyboardButton('Close', callback_data='closeMenu')) menu = build_menu(buttons,2) bot.send_message(chat_id=update.effective_chat.id,text="Please select the language of the community",reply_markup=InlineKeyboardMarkup(menu)) else: message(update,context,"Attention! this command can only be used in public supergroups!")
def welcome_bot(update, context): save_group(update) arr_buttons = [] arr_buttons.append( InlineKeyboardButton(text="🌐 Dashboard", url="https://nebula.squirrel-network.online")) arr_buttons.append( InlineKeyboardButton(text="📢 Bot_Logs", url="https://t.me/nebulalogs")) arr_buttons.append( InlineKeyboardButton(text="📰 Bot_News", url="https://t.me/nebulanewsbot")) arr_buttons.append( InlineKeyboardButton( text="🔷 Source Code", url="https://github.com/Squirrel-Network/nebula8")) arr_buttons.append( InlineKeyboardButton(text="👥 Support", url="https://t.me/nebulabot_support")) menu = build_menu(arr_buttons, 2) main_msg = Strings.WELCOME_BOT.format(Config.VERSION, Config.VERSION_NAME) update.message.reply_text(main_msg, reply_markup=InlineKeyboardMarkup(menu), parse_mode='HTML')
def init(update, context): # Get settings chat = update.effective_message.chat_id group = GroupRepository().getById(chat) if group: row = group['set_welcome'] block_user = group['block_new_member'] arabic_filter = group['set_arabic_filter'] cirillic_filter = group['set_cirillic_filter'] chinese_filter = group['set_chinese_filter'] user_profile_photo = group['set_user_profile_picture'] type_no_username = group['type_no_username'] zoophile_filter = group["zoophile_filter"] else: row = 1 block_user = 0 arabic_filter = 1 cirillic_filter = 1 chinese_filter = 1 user_profile_photo = 0 zoophile_filter = 1 if row == 0 and block_user == 1: for member in update.message.new_chat_members: kick_user(update, context) message( update, context, "<b>#Automatic Handler:</b> Kick User for group protection") if row == 1 and row is not None: for member in update.message.new_chat_members: user = member.username user_first = member.first_name user_id = member.id chat_title = update.effective_chat.title chat_id = update.effective_chat.id bot = bot_object(update, context) user_photo = member.get_profile_photos(member.id) # Welcome the bot when it is added if bot.id == user_id: l_txt = "#Log <b>Bot added to group</b> {}\nId: <code>{}</code>".format( chat_title, chat_id) telegram_loggers(update, context, l_txt) welcome_bot(update, context) # Kicked user because username field is empty elif user is None: if type_no_username == 1: message( update, context, '<a href="tg://user?id={}">{}</a> set an <b>username!</b> You were kicked for safety!' .format(user_id, user_first)) time.sleep(2) kick_user(update, context) elif type_no_username == 2: message( update, context, '<a href="tg://user?id={}">{}</a> set an <b>username!</b>' .format(user_id, user_first)) elif type_no_username == 3: message( update, context, '<a href="tg://user?id={}">{}</a> set an <b>username!</b> You were Muted for safety!' .format(user_id, user_first)) mute_user_by_id(update, context, member.id, True) elif type_no_username == 4: ban_user(update, context) message( update, context, '<a href="tg://user?id={}">{}</a> was banned because they did not have an username' .format(user_id, user_first)) elif type_no_username == 5: kick_user(update, context) elif has_zoophile(user_first) and zoophile_filter == 1: ban_user(update, context) message( update, context, "Nebula's automatic system intercepted a <b>zoophile!</b>\nI banned user {}" .format(mention_html(user_id, user_first))) else: arr_buttons = [] arr_buttons.append( InlineKeyboardButton(text="Bot_logs", url="https://t.me/nebulalogs")) menu = build_menu(arr_buttons, 2) main_msg = "Welcome {} in {}".format( mention_html(member.id, member.first_name), chat_title) update.message.reply_text( main_msg, reply_markup=InlineKeyboardMarkup(menu), parse_mode='HTML') print("No action even if you don't have a username") # They ban the user because he is blacklisted elif is_in_blacklist(user_id): ban_user(update, context) message( update, context, 'I got super banned <a href="tg://user?id={}">{}</a> [{}]'. format(user_id, user_first, user_id)) # They ban the user because he doesn't have a profile picture elif user_photo.total_count == 0 and user_profile_photo == 1: kick_user(update, context) message( update, context, '<a href="tg://user?id={}">{}</a> set a profile picture! You were kicked for safety!' .format(user_id, user_first)) # Banned user with arabic characters elif has_arabic_character(user_first) and arabic_filter == 1: ban_user(update, context) message( update, context, "Non-Latin filter activated for the user <code>{}</code>". format(mention_html(user_id, user_first))) # Banned user with cirillic characters elif has_cirillic_character(user_first) and cirillic_filter == 1: ban_user(update, context) message( update, context, "Non-Latin filter activated for the user <code>{}</code>". format(mention_html(user_id, user_first))) # Banned user with chinese characters elif has_chinese_character(user_first) and chinese_filter == 1: ban_user(update, context) message( update, context, "Non-Latin filter activated for the user <code>{}</code>". format(mention_html(user_id, user_first))) # Banned user with Zoophile characters elif has_zoophile(user_first) and zoophile_filter == 1: ban_user(update, context) message( update, context, "Nebula's automatic system intercepted a <b>zoophile!</b>\nI banned user {}" .format(mention_html(user_id, user_first))) # Welcome for bot owner elif user_id in OWNER_LIST: message( update, context, 'The bot operator <a href="tg://user?id={}">{}</a> has just joined the group' .format(user_id, user_first)) else: save_user(member, chat_id) welcome_user(update, context, member)