diff --git a/misskaty/core/message_utils.py b/misskaty/core/message_utils.py index e69de29b..4b56fd00 100644 --- a/misskaty/core/message_utils.py +++ b/misskaty/core/message_utils.py @@ -0,0 +1,16 @@ +import asyncio +from logging import getLogger + +LOGGER = getLogger(__name__) + + +async def kirimPesan(msg, text: str, reply_markup=None): + try: + return await msg.reply(text, disable_web_page_preview=True) + except FloodWait as e: + LOGGER.warning(str(e)) + await asyncio.sleep(e.value) + return await kirimPesan(text) + except Exception as e: + LOGGER.error(str(e)) + return diff --git a/misskaty/plugins/scrapwebsite.py b/misskaty/plugins/scrapwebsite.py index ddf40833..d953b4be 100644 --- a/misskaty/plugins/scrapwebsite.py +++ b/misskaty/plugins/scrapwebsite.py @@ -52,7 +52,7 @@ async def nodrakor(_, msg): if "Nothing Found" in entry[0].text: await m.delete() if title != "": - await msg.reply(f"404 Not FOUND For: {key}", True) + await msg.reply(f"404 Not FOUND For: {title}", True) else: await msg.reply(f"404 Not FOUND!", True) return @@ -97,9 +97,7 @@ async def ngefilm21(_, message): msg = await message.reply("Sedang proses scrap, mohon tunggu..") try: - html = await http.get( - f"https://ngefilm.info/search?q={title}", headers=headers - ) + html = await http.get(f"https://ngefilm.info/search?q={title}", headers=headers) soup = BeautifulSoup(html.text, "lxml") res = soup.find_all("h2") data = [] @@ -507,7 +505,7 @@ async def gomov_scrap(_, msg): if "Nothing Found" in entry[0].text: await m.delete() if title != "": - await msg.reply(f"404 Not FOUND For: {key}", True) + await msg.reply(f"404 Not FOUND For: {title}", True) else: await msg.reply(f"404 Not FOUND!", True) return