Update chatbot/plugins/chat.py
Browse files- chatbot/plugins/chat.py +72 -12
chatbot/plugins/chat.py
CHANGED
@@ -44,14 +44,6 @@ import akenoai.logger as akeno_log
|
|
44 |
|
45 |
from . import force_sub
|
46 |
|
47 |
-
@Client.on_message(
|
48 |
-
~filters.scheduled
|
49 |
-
& filters.command(["onchat"])
|
50 |
-
& ~filters.forwarded
|
51 |
-
)
|
52 |
-
async def addchatbot_user(client: Client, message: Message):
|
53 |
-
await db.add_chatbot(message.chat.id, client.me.id)
|
54 |
-
await message.reply_text("Added chatbot user")
|
55 |
|
56 |
BASE_PROMPT = f"""
|
57 |
You are my name Akeno AI and python language powered by @xtdevs on telegram support and language models GPT-5-ULTRA
|
@@ -111,12 +103,80 @@ async def startbot(client: Client, message: Message):
|
|
111 |
|
112 |
@Client.on_message(
|
113 |
~filters.scheduled
|
114 |
-
& filters.command(["
|
115 |
& ~filters.forwarded
|
116 |
)
|
117 |
-
async def
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
|
121 |
@Client.on_message(
|
122 |
~filters.scheduled
|
|
|
44 |
|
45 |
from . import force_sub
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
BASE_PROMPT = f"""
|
49 |
You are my name Akeno AI and python language powered by @xtdevs on telegram support and language models GPT-5-ULTRA
|
|
|
103 |
|
104 |
@Client.on_message(
|
105 |
~filters.scheduled
|
106 |
+
& filters.command(["onchat"])
|
107 |
& ~filters.forwarded
|
108 |
)
|
109 |
+
async def okon_(client: Client, message: Message):
|
110 |
+
buttons = [
|
111 |
+
[
|
112 |
+
InlineKeyboardButton(
|
113 |
+
text="Offline",
|
114 |
+
callback_data=f"off_{message.from_user.id}_{message.chat.id}"
|
115 |
+
),
|
116 |
+
InlineKeyboardButton(
|
117 |
+
text="Online",
|
118 |
+
callback_data=f"on_{message.from_user.id}_{message.chat.id}"
|
119 |
+
),
|
120 |
+
],
|
121 |
+
]
|
122 |
+
await message.reply_text(
|
123 |
+
"I want to go offline",
|
124 |
+
reply_markup=InlineKeyboardMarkup(buttons)
|
125 |
+
)
|
126 |
+
|
127 |
+
@Client.on_callback_query(filters.regex("^off_"))
|
128 |
+
async def off_mode(client, cb):
|
129 |
+
data = cb.data.split("_")
|
130 |
+
if len(data) != 3:
|
131 |
+
await cb.answer("❌ Format data tidak valid.", show_alert=True)
|
132 |
+
return
|
133 |
+
_, user_id_str, chat_id_str = data
|
134 |
+
try:
|
135 |
+
user_id = int(user_id_str)
|
136 |
+
except ValueError:
|
137 |
+
await cb.answer("❌ Invalid user ID.", show_alert=True)
|
138 |
+
return
|
139 |
+
try:
|
140 |
+
chat_id = int(chat_id_str)
|
141 |
+
except ValueError:
|
142 |
+
await cb.answer("❌ Invalid chat ID.", show_alert=True)
|
143 |
+
return
|
144 |
+
if cb.from_user.id != user_id:
|
145 |
+
await cb.answer("❌ You have no right to do this.", show_alert=True)
|
146 |
+
return
|
147 |
+
try:
|
148 |
+
await db.remove_chatbot(chat_id)
|
149 |
+
await cb.edit_message_text("ok stopped GPT")
|
150 |
+
await cb.answer()
|
151 |
+
except Exception as e:
|
152 |
+
await cb.answer(f"❌ Error: {e}", show_alert=True)
|
153 |
+
|
154 |
+
@Client.on_callback_query(filters.regex("^on_"))
|
155 |
+
async def on_mode(client: Client, cb: CallbackQuery):
|
156 |
+
data = cb.data.split("_")
|
157 |
+
if len(data) != 3:
|
158 |
+
await cb.answer("❌ Format data tidak valid.", show_alert=True)
|
159 |
+
return
|
160 |
+
_, user_id_str, chat_id_str = data
|
161 |
+
try:
|
162 |
+
user_id = int(user_id_str)
|
163 |
+
except ValueError:
|
164 |
+
await cb.answer("❌ Invalid user ID.", show_alert=True)
|
165 |
+
return
|
166 |
+
try:
|
167 |
+
chat_id = int(chat_id_str)
|
168 |
+
except ValueError:
|
169 |
+
await cb.answer("❌ Invalid chat ID.", show_alert=True)
|
170 |
+
return
|
171 |
+
if cb.from_user.id != user_id:
|
172 |
+
await cb.answer("❌ You have no right to do this.", show_alert=True)
|
173 |
+
return
|
174 |
+
try:
|
175 |
+
await db.add_chatbot(chat_id, client.me.id)
|
176 |
+
await cb.edit_message_text("Added chatbot user")
|
177 |
+
await cb.answer()
|
178 |
+
except Exception as e:
|
179 |
+
await cb.answer(f"❌ Error: {e}", show_alert=True)
|
180 |
|
181 |
@Client.on_message(
|
182 |
~filters.scheduled
|