Delete chatbot/plugins/web.py
Browse files- chatbot/plugins/web.py +0 -84
chatbot/plugins/web.py
DELETED
@@ -1,84 +0,0 @@
|
|
1 |
-
import asyncio
|
2 |
-
import time
|
3 |
-
import os
|
4 |
-
import datetime
|
5 |
-
import aiohttp
|
6 |
-
from pyrogram import Client, filters
|
7 |
-
from pyrogram.types import *
|
8 |
-
from pyrogram.enums import *
|
9 |
-
from pyrogram import *
|
10 |
-
from database import db
|
11 |
-
from chatbot.plugins.user_database import users_collection
|
12 |
-
from chatbot.plugins.keyboards import get_language_keyboard
|
13 |
-
from chatbot.plugins.languages import LANGUAGES
|
14 |
-
import akenoai as dev
|
15 |
-
|
16 |
-
from . import force_sub
|
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"])
|
34 |
-
& ~filters.forwarded
|
35 |
-
)
|
36 |
-
@force_sub
|
37 |
-
async def askwebcmd(client: Client, message: Message):
|
38 |
-
pro = await message.reply("Processing your web request...", quote=True)
|
39 |
-
user_id = message.from_user.id
|
40 |
-
user = await users_collection.find_one({"user_id": user_id})
|
41 |
-
lang = user.get("language") if user else LANGUAGES_DEFAULT
|
42 |
-
chat_user = await db.get_chatbot(message.chat.id)
|
43 |
-
if not chat_user:
|
44 |
-
return await pro.edit_text("I need to enable group")
|
45 |
-
if len(message.command) > 1:
|
46 |
-
prompt = message.text.split(maxsplit=1)[1]
|
47 |
-
elif message.reply_to_message:
|
48 |
-
prompt = message.reply_to_message.text
|
49 |
-
else:
|
50 |
-
return await pro.edit_text("Give ask from GPT-5")
|
51 |
-
await client.send_chat_action(message.chat.id, enums.ChatAction.TYPING)
|
52 |
-
await asyncio.sleep(1.5)
|
53 |
-
if not lang:
|
54 |
-
await message.reply(
|
55 |
-
"Please select your preferred language:",
|
56 |
-
reply_markup=get_language_keyboard()
|
57 |
-
)
|
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,
|
67 |
-
is_trans="True",
|
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 aiohttp.ContentTypeError as e:
|
75 |
-
return await pro.edit_text("Error: try again.")
|
76 |
-
except Exception as e:
|
77 |
-
await pro.edit_text("Error: try again")
|
78 |
-
|
79 |
-
@Client.on_message(filters.command("setlang"))
|
80 |
-
async def setlang_cmd(client: Client, message: Message):
|
81 |
-
await message.reply(
|
82 |
-
"Please select your preferred language:",
|
83 |
-
reply_markup=get_language_keyboard()
|
84 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|