upstream.pull(brname) await query.message.edit_text( 'Successfully Updated!\nBot is restarting...') except GitCommandError: repo.git.reset('--hard') repo.git.clean('-fd', 'nana/modules/') repo.git.clean('-fd', 'nana/assistant/') repo.git.clean('-fd', 'nana/helpers/') await query.message.edit_text( 'Successfully Force Updated!\nBot is restarting...') await update_changelog(changelog) await restart_all() if REMINDER_UPDATE and not TEST_DEVELOP: loop.create_task(update_checker()) async def starting_message(): start_message = f"Hi {OwnerName},\n" start_message += "Nana is Ready at your Service!\n" start_message += f"===================\n" if DB_AVAILABLE: start_message += f"**Group joined:** `{len(get_all_chats())} groups`\n" start_message += f"**Message received:** `{get_msgc()} messages`\n" start_message += f"===================\n" start_message += f"`For more about the bot press button down below`" buttons = InlineKeyboardMarkup( [[InlineKeyboardButton(text="Help", callback_data="help_back")]]) img = await get_theme("Nana-Official", "welcome") await setbot.send_photo(Owner,
"https://", "https://*****:*****@") if "heroku" in repo.remotes: remote = repo.remote("heroku") remote.set_url(heroku_git_url) else: remote = repo.create_remote("heroku", heroku_git_url) remote.push(refspec="HEAD:refs/heads/master") else: await client.send_message( Owner, "no heroku application found, but a key given? 😕 ") await client.send_message( Owner, "Build Unsuccess, Check heroku build log for more detail") return try: upstream.pull(brname) await client.send_message( Owner, "Successfully Updated!\nBot is restarting...") except GitCommandError: repo.git.reset("--hard") repo.git.clean("-fd", "nana/modules/") repo.git.clean("-fd", "nana/assistant/") repo.git.clean("-fd", "nana/helpers/") await client.send_message( Owner, "Successfully Force Updated!\nBot is restarting...") await update_changelog(changelog) await restart_all() if REMINDER_UPDATE and not TEST_DEVELOP: loop.create_task(update_checker())
from nana.assistant.database.theme_db import get_name_theme_set, is_custom_theme from nana.helpers.aiohttp_helper import AioHttp cache_theme = {} async def clear_theme_cache(): global cache_theme while True: if not cache_theme: await caching_theme() await asyncio.sleep(15) cache_theme = {} loop.create_task(clear_theme_cache()) async def caching_theme(): global cache_theme if not cache_theme: name = await get_name_theme_set(Owner) a = await is_custom_theme() if a: name = int(name[5:]) cache_theme = await get_custom_theme(name) else: theme = await AioHttp().get_json('http://api.harumi.tech/theme') cache_theme = { "welcome": theme[name]["welcome"],