diff --git a/misskaty/plugins/inkick_user.py b/misskaty/plugins/inkick_user.py
index 0a1ba139..218d95b8 100644
--- a/misskaty/plugins/inkick_user.py
+++ b/misskaty/plugins/inkick_user.py
@@ -129,6 +129,8 @@ async def dkick(client, message):
@app.on_message(filters.incoming & ~filters.private & filters.command(["instatus"], COMMAND_HANDLER))
async def instatus(client, message):
+ if message.sender_chat:
+ return await message.reply("Not supported channel.")
start_time = time.perf_counter()
user = await app.get_chat_member(message.chat.id, message.from_user.id)
count = await app.get_chat_members_count(message.chat.id)
diff --git a/misskaty/plugins/web_scraper.py b/misskaty/plugins/web_scraper.py
index f197acc6..45fc6e32 100644
--- a/misskaty/plugins/web_scraper.py
+++ b/misskaty/plugins/web_scraper.py
@@ -43,24 +43,24 @@ def split_arr(arr, size: 5):
return arrs
# Terbit21 GetData
-async def getDataTerbit21(msg, kueri, CurrentPage):
- if not SCRAP_DICT.get(msg.id):
+async def getDataTerbit21(msg, idpesan, kueri, CurrentPage):
+ if not SCRAP_DICT.get(idpesan):
if not kueri:
terbitjson = (await http.get('https://yasirapi.eu.org/terbit21')).json()
else:
terbitjson = (await http.get(f'https://yasirapi.eu.org/terbit21?q={kueri}')).json()
if not terbitjson.get("result"):
return await msg.reply("Sorry, could not find any results!")
- SCRAP_DICT[msg.id] = [split_arr(terbitjson["result"], 6), kueri]
+ SCRAP_DICT[idpesan] = [split_arr(terbitjson["result"], 6), kueri]
try:
index = int(CurrentPage - 1)
- PageLen = len(SCRAP_DICT[msg.id][0])
+ PageLen = len(SCRAP_DICT[idpesan][0])
if kueri:
TerbitRes = f"#Terbit21 Results For: {kueri}\n\n"
else:
TerbitRes = "#Terbit21 Latest:\nš Use /terbit21 [title] to start search with title.\n\n"
- for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
+ for c, i in enumerate(SCRAP_DICT[idpesan][0][index], start=1):
TerbitRes += f"{c}. {i['judul']}\nCategory: {i['kategori']}\n"
TerbitRes += "\n" if re.search(r"Complete|Ongoing", i["kategori"]) else f"š Download\n\n"
IGNORE_CHAR = "[]"
@@ -70,24 +70,24 @@ async def getDataTerbit21(msg, kueri, CurrentPage):
await msg.reply("Sorry, could not find any results!")
# LK21 GetData
-async def getDatalk21(msg, kueri, CurrentPage):
- if not SCRAP_DICT.get(msg.id):
+async def getDatalk21(msg, idpesan, kueri, CurrentPage):
+ if not SCRAP_DICT.get(idpesan):
if not kueri:
lk21json = (await http.get('https://yasirapi.eu.org/lk21')).json()
else:
lk21json = (await http.get(f'https://yasirapi.eu.org/lk21?q={kueri}')).json()
if not lk21json.get("result"):
return await msg.reply("Sorry could not find any matching results!")
- SCRAP_DICT[msg.id] = [split_arr(lk21json["result"], 6), kueri]
+ SCRAP_DICT[idpesan] = [split_arr(lk21json["result"], 6), kueri]
try:
index = int(CurrentPage - 1)
- PageLen = len(SCRAP_DICT[msg.id][0])
+ PageLen = len(SCRAP_DICT[idpesan][0])
if kueri:
lkResult = f"#Layarkaca21 Results For: {kueri}\n\n"
else:
lkResult = "#Layarkaca21 Latest:\nš Use /lk21 [title] to start search with title.\n\n"
- for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
+ for c, i in enumerate(SCRAP_DICT[idpesan][0][index], start=1):
lkResult += f"{c}. {i['judul']}\nCategory: {i['kategori']}\n"
lkResult += "\n" if re.search(r"Complete|Ongoing", i["kategori"]) else f"š Download\n\n"
IGNORE_CHAR = "[]"
@@ -97,18 +97,18 @@ async def getDatalk21(msg, kueri, CurrentPage):
await msg.reply("Sorry could not find any matching results!")
# Pahe GetData
-async def getDataPahe(msg, kueri, CurrentPage):
- if not SCRAP_DICT.get(msg.id):
+async def getDataPahe(msg, idpesan, kueri, CurrentPage):
+ if not SCRAP_DICT.get(idpesan):
pahejson = (await http.get(f'https://yasirapi.eu.org/pahe?q={kueri}')).json()
if not pahejson.get("result"):
return await msg.reply("Sorry could not find any matching results!", quote=True)
- SCRAP_DICT[msg.id] = [split_arr(pahejson["result"], 6), kueri]
+ SCRAP_DICT[idpesan] = [split_arr(pahejson["result"], 6), kueri]
try:
index = int(CurrentPage - 1)
- PageLen = len(SCRAP_DICT[msg.id][0])
+ PageLen = len(SCRAP_DICT[idpesan][0])
paheResult = f"#Pahe Results For: {kueri}\n\n" if kueri else f"#Pahe Latest:\nš Use /pahe [title] to start search with title.\n\n"
- for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
+ for c, i in enumerate(SCRAP_DICT[idpesan][0][index], start=1):
paheResult += f"{c}. {i['judul']}\n\n"
IGNORE_CHAR = "[]"
paheResult = ''.join(i for i in paheResult if not i in IGNORE_CHAR)
@@ -117,8 +117,8 @@ async def getDataPahe(msg, kueri, CurrentPage):
await msg.reply("Sorry could not find any matching results!")
# GoMov GetData
-async def getDataGomov(msg, kueri, CurrentPage):
- if not SCRAP_DICT.get(msg.id):
+async def getDataGomov(msg, idpesan, kueri, CurrentPage):
+ if not SCRAP_DICT.get(idpesan):
gomovv = await http.get(f'https://185.173.38.216/?s=')
text = BeautifulSoup(gomovv.text, "lxml")
entry = text.find_all(class_="entry-header")
@@ -134,13 +134,13 @@ async def getDataGomov(msg, kueri, CurrentPage):
judul = i.find(class_="entry-title").find("a").text
link = i.find(class_="entry-title").find("a").get("href")
data.append({"judul": judul, "link": link, "genre": genre})
- SCRAP_DICT[msg.id] = [split_arr(data, 6), kueri]
+ SCRAP_DICT[idpesan] = [split_arr(data, 6), kueri]
try:
index = int(CurrentPage - 1)
- PageLen = len(SCRAP_DICT[msg.id][0])
+ PageLen = len(SCRAP_DICT[idpesan][0])
gomovResult = f"#Gomov Results For: {kueri}\n\n" if kueri else f"#Gomov Latest:\nš Use /{msg.command[0]} [title] to start search with title.\n\n"
- for c, i in enumerate(SCRAP_DICT[msg.id][0][index], start=1):
+ for c, i in enumerate(SCRAP_DICT[idpesan][0][index], start=1):
gomovResult += f"{c}. {i['judul']}\nGenre: {i['genre']}\n"
gomovResult += "\n" if re.search(r"Series", i["genre"]) else f"Extract: /{msg.command[0]}_scrap {i['link']}\n\n"
IGNORE_CHAR = "[]"
@@ -152,13 +152,12 @@ async def getDataGomov(msg, kueri, CurrentPage):
# Terbit21 CMD
@app.on_message(filters.command(['terbit21'], COMMAND_HANDLER))
async def terbit21_s(client, message):
- chat_id = message.chat.id
kueri = ' '.join(message.command[1:])
if not kueri:
kueri = None
pesan = await message.reply("Getting data from Terbit21..")
CurrentPage = 1
- terbitres, PageLen = await getDataTerbit21(message, kueri, CurrentPage)
+ terbitres, PageLen = await getDataTerbit21(message, pesan.id, kueri, CurrentPage)
keyboard = InlineKeyboard()
keyboard.paginate(PageLen, CurrentPage, 'page_terbit21#{number}' + f'#{pesan.id}#{message.from_user.id}')
keyboard.row(
@@ -175,7 +174,7 @@ async def lk21_s(client, message):
kueri = None
pesan = await message.reply("Getting data from LK21..")
CurrentPage = 1
- lkres, PageLen = await getDatalk21(message, kueri, CurrentPage)
+ lkres, PageLen = await getDatalk21(message, pesan.id, kueri, CurrentPage)
keyboard = InlineKeyboard()
keyboard.paginate(PageLen, CurrentPage, 'page_lk21#{number}' + f'#{pesan.id}#{message.from_user.id}')
keyboard.row(
@@ -192,7 +191,7 @@ async def pahe_s(client, message):
kueri = ""
pesan = await message.reply("Getting data from Pahe Web..")
CurrentPage = 1
- paheres, PageLen = await getDataPahe(message, kueri, CurrentPage)
+ paheres, PageLen = await getDataPahe(message, pesan.id, kueri, CurrentPage)
keyboard = InlineKeyboard()
keyboard.paginate(PageLen, CurrentPage, 'page_pahe#{number}' + f'#{pesan.id}#{message.from_user.id}')
keyboard.row(
@@ -203,13 +202,12 @@ async def pahe_s(client, message):
# Gomov CMD
@app.on_message(filters.command(['gomov'], COMMAND_HANDLER))
async def gomov_s(client, message):
- chat_id = message.chat.id
kueri = ' '.join(message.command[1:])
if not kueri:
kueri = ""
pesan = await message.reply("Getting data from Gomov Web..")
CurrentPage = 1
- gomovres, PageLen = await getDataGomov(message, kueri, CurrentPage)
+ gomovres, PageLen = await getDataGomov(message, pesan.id, kueri, CurrentPage)
keyboard = InlineKeyboard()
keyboard.paginate(PageLen, CurrentPage, 'page_gomov#{number}' + f'#{pesan.id}#{message.from_user.id}')
keyboard.row(
@@ -223,7 +221,6 @@ async def terbit21page_callback(client, callback_query):
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
return await callback_query.answer("Not yours..", True)
message_id = int(callback_query.data.split('#')[2])
- chat_id = callback_query.message.chat.id
CurrentPage = int(callback_query.data.split('#')[1])
try:
kueri = SCRAP_DICT[message_id][1]
@@ -231,7 +228,7 @@ async def terbit21page_callback(client, callback_query):
return await callback_query.answer("Invalid callback data, please send CMD again..")
try:
- terbitres, PageLen = await getDataTerbit21(callback_query.message, kueri, CurrentPage)
+ terbitres, PageLen = await getDataTerbit21(callback_query.message, message_id, kueri, CurrentPage)
except TypeError:
return
@@ -248,7 +245,6 @@ async def lk21page_callback(client, callback_query):
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
return await callback_query.answer("Not yours..", True)
message_id = int(callback_query.data.split('#')[2])
- chat_id = callback_query.message.chat.id
CurrentPage = int(callback_query.data.split('#')[1])
try:
kueri = SCRAP_DICT[message_id][1]
@@ -256,7 +252,7 @@ async def lk21page_callback(client, callback_query):
return await callback_query.answer("Invalid callback data, please send CMD again..")
try:
- lkres, PageLen = await getDatalk21(callback_query.message, kueri, CurrentPage)
+ lkres, PageLen = await getDatalk21(callback_query.message, message_id, kueri, CurrentPage)
except TypeError:
return
@@ -273,7 +269,6 @@ async def pahepage_callback(client, callback_query):
if callback_query.from_user.id != int(callback_query.data.split('#')[3]):
return await callback_query.answer("Not yours..", True)
message_id = int(callback_query.data.split('#')[2])
- chat_id = callback_query.message.chat.id
CurrentPage = int(callback_query.data.split('#')[1])
try:
kueri = SCRAP_DICT[message_id][1]
@@ -281,7 +276,7 @@ async def pahepage_callback(client, callback_query):
return await callback_query.answer("Invalid callback data, please send CMD again..")
try:
- lkres, PageLen = await getDataPahe(callback_query.message, kueri, CurrentPage)
+ lkres, PageLen = await getDataPahe(callback_query.message, message_id, kueri, CurrentPage)
except TypeError:
return
@@ -305,7 +300,7 @@ async def pahepage_callback(client, callback_query):
return await callback_query.answer("Invalid callback data, please send CMD again..")
try:
- gomovres, PageLen = await getDataGomov(callback_query.message, kueri, CurrentPage)
+ gomovres, PageLen = await getDataGomov(callback_query.message, message_id, kueri, CurrentPage)
except TypeError:
return