Update Akeno/plugins/chatgpt.py
Browse files- Akeno/plugins/chatgpt.py +31 -1
Akeno/plugins/chatgpt.py
CHANGED
@@ -24,7 +24,7 @@ from pyrogram import Client, filters
|
|
24 |
from pyrogram.types import *
|
25 |
from RyuzakiLib import FaceAI, FullStackDev, GeminiLatest, RendyDevChat
|
26 |
|
27 |
-
from Akeno.utils.chat import
|
28 |
from Akeno.utils.tools import *
|
29 |
from Akeno.utils.database import db
|
30 |
from Akeno.utils.handler import *
|
@@ -423,6 +423,36 @@ async def chatgpt(client: Client, message: Message):
|
|
423 |
LOGS.error(str(e))
|
424 |
return await message.reply_text(str(e))
|
425 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
426 |
module = modules_help.add_module("chatgpt", __file__)
|
427 |
module.add_command("askf", "to read in the picture")
|
428 |
module.add_command("askm", "to give random image questions")
|
|
|
24 |
from pyrogram.types import *
|
25 |
from RyuzakiLib import FaceAI, FullStackDev, GeminiLatest, RendyDevChat
|
26 |
|
27 |
+
from Akeno.utils.chat import *
|
28 |
from Akeno.utils.tools import *
|
29 |
from Akeno.utils.database import db
|
30 |
from Akeno.utils.handler import *
|
|
|
423 |
LOGS.error(str(e))
|
424 |
return await message.reply_text(str(e))
|
425 |
|
426 |
+
@Akeno(
|
427 |
+
~filters.scheduled
|
428 |
+
& filters.command(["askcode"], CMD_HANDLER)
|
429 |
+
& filters.me
|
430 |
+
& ~filters.forwarded
|
431 |
+
)
|
432 |
+
async def chatgptcode(client: Client, message: Message):
|
433 |
+
if len(message.command) > 1:
|
434 |
+
prompt = message.text.split(maxsplit=1)[1]
|
435 |
+
elif message.reply_to_message:
|
436 |
+
prompt = message.reply_to_message.text
|
437 |
+
else:
|
438 |
+
return await message.reply_text("Give ask from CHATGPT-4O")
|
439 |
+
try:
|
440 |
+
messager = await chat_message_codegen(prompt)
|
441 |
+
if len(messager) > 4096:
|
442 |
+
with open("chat.txt", "w+", encoding="utf8") as out_file:
|
443 |
+
out_file.write(messager)
|
444 |
+
await message.reply_document(
|
445 |
+
document="chat.txt",
|
446 |
+
disable_notification=True
|
447 |
+
)
|
448 |
+
os.remove("chat.txt")
|
449 |
+
else:
|
450 |
+
await message.reply_text(messager, reply_to_message_id=ReplyCheck(message))
|
451 |
+
except Exception as e:
|
452 |
+
LOGS.error(str(e))
|
453 |
+
return await message.reply_text(str(e))
|
454 |
+
|
455 |
+
|
456 |
module = modules_help.add_module("chatgpt", __file__)
|
457 |
module.add_command("askf", "to read in the picture")
|
458 |
module.add_command("askm", "to give random image questions")
|