Update chatbot/plugins/web.py
Browse files- chatbot/plugins/web.py +17 -0
chatbot/plugins/web.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import asyncio
|
2 |
import time
|
3 |
import os
|
|
|
4 |
|
5 |
from pyrogram import Client, filters
|
6 |
from pyrogram.types import *
|
@@ -16,6 +17,17 @@ from . import force_sub
|
|
16 |
|
17 |
LANGUAGES_DEFAULT = "en"
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
@Client.on_message(
|
20 |
~filters.scheduled
|
21 |
& filters.command(["web"])
|
@@ -46,6 +58,9 @@ async def askwebcmd(client: Client, message: Message):
|
|
46 |
await pro.delete()
|
47 |
return
|
48 |
try:
|
|
|
|
|
|
|
49 |
akeno_api = dev.AkenoPlus(...)
|
50 |
response = await akeno_api.chatgpt_mode_web(
|
51 |
query=prompt,
|
@@ -53,7 +68,9 @@ async def askwebcmd(client: Client, message: Message):
|
|
53 |
lang=lang
|
54 |
)
|
55 |
data = await akeno_api.get_json(response=response)
|
|
|
56 |
await pro.edit_text(data.randydev.message, disable_web_page_preview=True)
|
|
|
57 |
except Exception as e:
|
58 |
await pro.edit_text(f"Error: {e}")
|
59 |
|
|
|
1 |
import asyncio
|
2 |
import time
|
3 |
import os
|
4 |
+
import datetime
|
5 |
|
6 |
from pyrogram import Client, filters
|
7 |
from pyrogram.types import *
|
|
|
17 |
|
18 |
LANGUAGES_DEFAULT = "en"
|
19 |
|
20 |
+
|
21 |
+
BASE_PROMPT = f"""
|
22 |
+
You are my name Akeno AI and python language powered by @xtdevs on telegram support and language models GPT-5-ULTRA
|
23 |
+
|
24 |
+
- off topic free questions
|
25 |
+
- Code python clone user telegram available : [HERE LINK](https://github.com/TeamKillerX/akenoai-lib/blob/main/examples/clone.py) by credits @xtdevs
|
26 |
+
- Support pyrogram and telethon not python-telegram-bot
|
27 |
+
|
28 |
+
{datetime.datetime.now()}
|
29 |
+
"""
|
30 |
+
|
31 |
@Client.on_message(
|
32 |
~filters.scheduled
|
33 |
& filters.command(["web"])
|
|
|
58 |
await pro.delete()
|
59 |
return
|
60 |
try:
|
61 |
+
backup_chat = await db._get_openai_chat_from_db(message.from_user.id)
|
62 |
+
backup_chat.append({"role": "system", "content": BASE_PROMPT})
|
63 |
+
backup_chat.append({"role": "user", "content": prompt})
|
64 |
akeno_api = dev.AkenoPlus(...)
|
65 |
response = await akeno_api.chatgpt_mode_web(
|
66 |
query=prompt,
|
|
|
68 |
lang=lang
|
69 |
)
|
70 |
data = await akeno_api.get_json(response=response)
|
71 |
+
backup_chat.append({"role": "assistant", "content": data.randydev.message})
|
72 |
await pro.edit_text(data.randydev.message, disable_web_page_preview=True)
|
73 |
+
await db._update_openai_chat_in_db(message.from_user.id, backup_chat)
|
74 |
except Exception as e:
|
75 |
await pro.edit_text(f"Error: {e}")
|
76 |
|