diff --git a/misskaty/plugins/chatbot_ai.py b/misskaty/plugins/chatbot_ai.py index 88ef935a..2821e02e 100644 --- a/misskaty/plugins/chatbot_ai.py +++ b/misskaty/plugins/chatbot_ai.py @@ -20,16 +20,19 @@ async def chatbot(c, m): } json_data = { - "model": "text-davinci-003", - "prompt": pertanyaan, - "max_tokens": 200, - "temperature": 0, + "model": "gpt-3.5-turbo", + "messages": [ + { + "role": "user", + "content": pertanyaan, + }, + ], } msg = await kirimPesan(m, "Wait a moment looking for your answer..") try: - response = (await http.post("https://api.openai.com/v1/completions", headers=headers, json=json_data)).json() - await editPesan(msg, response["choices"][0]["text"]) + response = (await http.post("https://api.openai.com/v1/chat/completions", headers=headers, json=json_data)).json() + await editPesan(msg, response["choices"][0]["message"]["content"]) except MessageNotModified: pass - except Exception: - await editPesan(msg, "Yahh, sorry i can't get your answer.") + except Exception as err: + await editPesan(msg, f"Oppss. ERROR: {err}") diff --git a/misskaty/plugins/imdb_search.py b/misskaty/plugins/imdb_search.py index 8450147a..31eea574 100644 --- a/misskaty/plugins/imdb_search.py +++ b/misskaty/plugins/imdb_search.py @@ -298,7 +298,7 @@ async def imdb_id_callback(_, query): ott = await search_jw(r_json.get("name"), "ID") typee = r_json.get("@type", "") res_str = "" - tahun = re.findall("\d{4}", sop.title.text)[0] if re.findall("\d{4}", sop.title.text) else "N/A" + tahun = re.findall("\((\d{4})\)", sop.title.text)[0] if re.findall("\((\d{4})\)", sop.title.text) else "N/A" res_str += f"📹 Judul: {r_json.get('name')} [{tahun}] ({typee})\n" if aka := r_json.get("alternateName"): res_str += f"📢 AKA: {aka}\n\n" @@ -415,7 +415,7 @@ async def imdb_en_callback(bot, query): ott = await search_jw(r_json.get("name"), "US") typee = r_json.get("@type", "") res_str = "" - tahun = re.findall("\d{4}", sop.title.text)[0] if re.findall("\d{4}", sop.title.text) else "N/A" + tahun = re.findall("\((\d{4})\)", sop.title.text)[0] if re.findall("\((\d{4})\)", sop.title.text) else "N/A" res_str += f"📹 Judul: {r_json.get('name')} [{tahun}] ({typee})\n" if aka := r_json.get("alternateName"): res_str += f"📢 AKA: {aka}\n\n" diff --git a/misskaty/plugins/inline_search.py b/misskaty/plugins/inline_search.py index 6da7a6db..fdc9f28e 100644 --- a/misskaty/plugins/inline_search.py +++ b/misskaty/plugins/inline_search.py @@ -550,7 +550,7 @@ async def imdb_inl(_, query): ott = await search_jw(r_json["name"], "en_ID") res_str = "" typee = r_json.get("@type", "") - tahun = re.findall("\d{4}", sop.title.text)[0] if re.findall("\d{4}", sop.title.text) else "N/A" + tahun = re.findall("\((\d{4})\)", sop.title.text)[0] if re.findall("\((\d{4})\)", sop.title.text) else "N/A" res_str += f"📹 Judul: {r_json['name']} [{tahun}] ({typee})\n" if r_json.get("alternateName"): res_str += f"📢 AKA: {r_json.get('alternateName')}\n\n" diff --git a/misskaty/plugins/web_scraper.py b/misskaty/plugins/web_scraper.py index 7db65384..fb7222da 100644 --- a/misskaty/plugins/web_scraper.py +++ b/misskaty/plugins/web_scraper.py @@ -198,7 +198,7 @@ async def getDataMovieku(msg, kueri, CurrentPage): async def getDataSavefilm21(msg, kueri, CurrentPage, user): if not SCRAP_DICT.get(msg.id): sfdata = [] - data = await http.get(f"https://45.136.197.138/?s={kueri}", headers=headers) + data = await http.get(f"https://193.43.104.235/?s={kueri}", headers=headers) text = BeautifulSoup(data, "lxml") entry = text.find_all(class_="entry-header") if "Tidak Ditemukan" in entry[0].text: