From 04294c7f4f9c13b5ca65a0f21532565462c85245 Mon Sep 17 00:00:00 2001 From: Yasir Aris M Date: Sun, 1 Sep 2024 12:32:52 +0700 Subject: [PATCH] Test with privatebin --- misskaty/plugins/chatbot_ai.py | 9 ++++----- misskaty/plugins/paste.py | 4 ++-- requirements.txt | 1 + 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/misskaty/plugins/chatbot_ai.py b/misskaty/plugins/chatbot_ai.py index 8d7649e4de..57e24a22bc 100644 --- a/misskaty/plugins/chatbot_ai.py +++ b/misskaty/plugins/chatbot_ai.py @@ -4,6 +4,7 @@ # * Copyright ©YasirPedia All rights reserved import asyncio import html +import privatebinapi from cachetools import TTLCache from openai import APIConnectionError, APIStatusError, AsyncOpenAI, RateLimitError @@ -51,11 +52,9 @@ async def get_openai_stream_response(is_stream, key, base_url, model, messages, num = 0 await bmsg.edit_msg(f"{html.escape(answer)}\n\nPowered by: GPT 4o") except MessageTooLong: - answerlink = await post_to_telegraph( - False, "MissKaty ChatBot ", html.escape(f"{answer}") - ) + answerlink = await privatebinapi.send_async("https://bin.yasirweb.eu.org", text=html.escape(f"{answer}"), expiration="1week", formatting="markdown") await bmsg.edit_msg( - strings("answers_too_long").format(answerlink=answerlink), + strings("answers_too_long").format(answerlink=answerlink.get("full_url")), disable_web_page_preview=True, ) except APIConnectionError as e: @@ -127,7 +126,7 @@ async def openai_chatbot(self, ctx: Message, strings): ai_response = await get_openai_stream_response(True, OPENAI_KEY, "https://models.inference.ai.azure.com" if uid in SUDO else "https://duckai.yasirapi.eu.org/v1", "gpt-4o" if uid in SUDO else "gpt-4o-mini", gptai_conversations[uid], msg, strings) if not ai_response: gptai_conversations[uid].pop() - if len(_conversations[uid]) == 1: + if len(gptai_conversations[uid]) == 1: gptai_conversations.pop(uid) return gptai_conversations[uid].append({"role": "assistant", "content": ai_response}) diff --git a/misskaty/plugins/paste.py b/misskaty/plugins/paste.py index d32a97f73d..e06d4a322c 100644 --- a/misskaty/plugins/paste.py +++ b/misskaty/plugins/paste.py @@ -286,10 +286,10 @@ async def nekopaste(_, message): try: x = ( await fetch.post( - "https://nekobin.com/api/documents", json={"content": data} + "https://bin.mayuri.my.id/api/documents", json={"content": data} ) ).json() - url = f"https://nekobin.com/{x['result']['key']}" + url = f"https://bin.mayuri.my.id/{x['result']['key']}" except Exception as e: return await msg.edit_msg(f"ERROR: {e}") diff --git a/requirements.txt b/requirements.txt index 3b476bca31..87d7f3ccea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,6 +20,7 @@ python-dateutil telegraph hachoir Pillow==10.4.0 +PrivateBinAPI httpx[http2] git+https://github.com/yasirarism/vcsi git+https://github.com/yasirarism/iytdl