from datetime import datetime as dt, timedelta
from pytz import timezone
import asyncio
import os
import pyromod
import random
from secure import SECURETY
import requests
from asyncio.exceptions import TimeoutError
from random import choice
from pyrogram import Client as ren
from pyrogram import *
from pyrogram.enums import *
from pyrogram.enums.parse_mode import ParseMode
from pyrogram.types import *
from pyrogram.errors import *
from pyrogram import __version__ as pyro
from akn.manage.parameter import *
from akn.utils.database import db as db_client
from akn.utils.logger import LOGS
from akn import gemini_bot_id
from config import *
from box import Box
BOTS_LIST_POPULER = """
π₯ **Hidden Gem Bots** π₯
These underrated bots pack powerful features while maintaining strict security standards:
π€ **@aknuserbot**
βΈ AI-powered Swiss Army knife
βΈ Secure session management
βΈ 50+ tools in one place
**Type:** Multipurpose | **Lang:** Python
"""
USERBOT_UPDATE_TEXT = """
**Akeno Userbot (OLD)**
π **New Features:**
- Unlimited real-time userbot operation
- Enhanced session management
- Improved stability and performance
π **Usage Guidelines:**
1. Legal use only (no spam/scams)
2. Respect Telegram's ToS
3. No unauthorized promotions
π Last Updated: 24-04-2025
"""
PYTHON_COHERE = """
```py
import json
from akenoai import OldAkenoXToJs
response = await OldAkenoXToJs.randydev(
"ai/cohere/command-plus",
api_key="{api_key}",
custom_dev_fast=True,
query="what is AkenoX AI?",
chatHistory=[],
system_prompt="You are a helpful AI assistant designed to provide clear and concise responses."
)
print(response)
```
"""
BOT_CLONE_FEATURES = """
π **Welcome to Customize Bot Clone!** π
Hereβs what you can do with our bot:
β¨ **Features**:
- **Magic Font**: Transform your text into stylish fonts.
- **YouTube Tools**: Download videos, audio, and more.
- **Meta AI**: Access advanced AI-powered features.
- **Gemini AI**: Explore cutting-edge AI capabilities.
- **Session Pyrogram & Telethon**: Support Userbot with Pyrogram and Telethon
- **Captcha Bot: Approved Captcha in Group Support
- **Azrea Bot**: everything support
π **Get Started Now!**
"""
BANNED_APIKEY = """
You have been banned and can no longer create an API key.
Reason: Previous issues occurred again.
Also, stop monitoring and asking for other people's API keys this is against the rules. Calm down! If you get a message like that, it means there is a serious problem with your account. You shouldn't touch other people's APIs carelessly, let alone keep trying if they've been blocked. Before making a fuss, make sure you understand the situation first. Answer properly, and if there's an issue, clarify it with a clear mind. Don't just react emotionally think before you speak. If youβre really in the right, explain it properly instead of causing more problems.""" CUSTOM_KEY = """ **Welcome to AkenoX API!** Weβre excited to have you here! Hereβs what you can enjoy: β¨ **Features**: - **V1**: Free and unlimited access for all users. - **V2**: Premium features with a 30-day free trial. π¨ **Important Rules**: To ensure a safe and fair environment for everyone, please adhere to the following rules: 1. **Prohibited Actions**: - Exploiting or abusing the API for malicious purposes. - Sharing API keys or credentials with unauthorized users. - Violating any applicable laws or regulations. 2. **Consequences**: - Breaking the rules will result in immediate suspension or banning. - Harassment or misuse of the API will not be tolerated. π **Your Safety Matters**: If you encounter any issues or feel harassed, please contact our support team immediately. π **Get Started Now!** """ YOU_KEY_TEXT = """ AkenoX API Key Generated π **API Key:**
{type}
β **Expired:** {ttn}
π
**Created At:** {create_at}
β οΈ **Warning:** Do not share this token with anyone!
"""
@ren.on_callback_query(filters.regex("^aggrement"))
async def aggrement_ok(client, query):
await query.message.delete()
await db_client.claim_privacy_policy(query.from_user.id)
await client.send_message(
query.from_user.id,
"You have agreed to the privacy policy, you can now use the bot."
)
@ren.on_callback_query(filters.regex("^privacy_policy"))
async def privacy_policy_ok(client, query):
keyboard_back = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
"β
Your Aggrement",
callback_data="aggrement"
),
],
[
InlineKeyboardButton(
"β Close",
callback_data="close"
)
]
]
)
await query.edit_message_text(
text=SECURETY,
reply_markup=keyboard_back
)
@ren.on_callback_query(filters.regex("^custom_ban"))
async def cb_custom_bans(client, query):
if not await db_client.get_privacy_policy(query.from_user.id):
return await query.answer("You must agree to the privacy policy first.", True)
keyboard_back = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Delete key Permanent",
callback_data="banyes_yes"
)
],
[
InlineKeyboardButton(
text="NO, Back",
callback_data="custom_key"
)
]
]
)
await query.edit_message_text(
text="You choose one can delete api key permanently or back",
reply_markup=keyboard_back
)
@ren.on_callback_query(filters.regex("^banyes_"))
async def cb_banned_nothing(client, query):
action = query.data.split("_", 1)[1]
if action == "yes":
keyboard_back = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Yes, delete the key",
callback_data="banned_and_key"
)
],
[
InlineKeyboardButton(
text="NO, Back",
callback_data="custom_key"
)
]
]
)
await query.edit_message_text(
text="You are about to delete your API Key",
reply_markup=keyboard_back
)
elif action == "no":
keyboard_back = InlineKeyboardMarkup(
[[
InlineKeyboardButton(
"π Back",
callback_data="custom_key"
)
]]
)
await query.edit_message_text(
text=CUSTOM_KEY,
reply_markup=keyboard_back
)
@ren.on_callback_query(filters.regex("^banned_and_key"))
async def cb_banned_and_key(client, query):
user_id = query.from_user.id
url = "https://randydev-ryu-js.hf.space/api/v1/key/ban-and-delete"
params = {"user_id": user_id}
response = requests.post(
url,
params=params,
headers={"x-api-key": os.environ.get("AKENOX_KEY")}
)
if response.status_code != 200:
return await query.answer("Error api try again", True)
resonse_data = response.json()
keyboard_back = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
"π Back",
callback_data="contet"
)
]
]
)
await query.edit_message_text(
text=resonse_data["message"],
reply_markup=keyboard_back
)
@ren.on_callback_query(filters.regex("^bots_popular$"))
async def cb_bots_popular(client, query):
if not await db_client.get_privacy_policy(query.from_user.id):
return await query.answer("You must agree to the privacy policy first.", True)
keyboard_back = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
"@MagicStylish_Bot",
url="https://t.me/MagicStylish_Bot"
),
InlineKeyboardButton(
"@tiktokbeta_dl_bot",
url="https://t.me/tiktokbeta_dl_bot"
)
],
[
InlineKeyboardButton(
"@UserApproveCaptchaBot",
url="https://t.me/UserApproveCaptchaBot"
),
InlineKeyboardButton(
"@SessionDevBot",
url="https://t.me/SessionDevBot"
)
],
[
InlineKeyboardButton(
"@ryuzaki_asstbot",
url="https://t.me/ryuzaki_asstbot"
),
InlineKeyboardButton(
"@AzreaDev_Bot",
url="https://t.me/AzreaDev_Bot"
)
],
[
InlineKeyboardButton(
"Credits Developer",
url="https://t.me/xtdevs"
)
],
[
InlineKeyboardButton(
"Back",
callback_data="contet"
)
]
]
)
return await query.edit_message_text(
text=BOTS_LIST_POPULER,
reply_markup=keyboard_back
)
@ren.on_callback_query(filters.regex("^customzie_bot"))
async def cb_customiz_bot(client, query):
if not await db_client.get_privacy_policy(query.from_user.id):
return await query.answer("You must agree to the privacy policy first.", True)
keyboard_back = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
"ποΈ Magic Bot",
callback_data="tutorial_magic"
),
InlineKeyboardButton(
"π Gemini Bot",
callback_data="tutorial_gemini"
),
],
[
InlineKeyboardButton(
"πͺ Meta AI Bot",
callback_data="tutorial_meta"
),
InlineKeyboardButton(
"π€ YouTube Bot",
callback_data="tutorial_yt"
),
],
[
InlineKeyboardButton(
"π Session Bot",
callback_data="tutorial_sesikntl"
),
InlineKeyboardButton(
"βοΈ Captcha Bot",
callback_data="tutorial_captcha"
),
],
[
InlineKeyboardButton(
"π Azrea Bot",
callback_data="tutorial_alldlbot"
),
],
[
InlineKeyboardButton(
"π Back",
callback_data="contet"
)
]
]
)
return await query.edit_message_text(
text=BOT_CLONE_FEATURES,
reply_markup=keyboard_back
)
@ren.on_callback_query(filters.regex("^custom_key"))
async def cb_custom_key(client, query):
if not await db_client.get_privacy_policy(query.from_user.id):
return await query.answer("You must agree to the privacy policy first.", True)
keyboard_back = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
"API key V1",
callback_data="createkey"
),
InlineKeyboardButton(
"API key V2",
callback_data="createkeyprem"
),
],
[
InlineKeyboardButton(
"Delete API Key",
callback_data="custom_ban"
),
],
[
InlineKeyboardButton(
"π Back",
callback_data="contet"
)
]
]
)
return await query.edit_message_text(
text=CUSTOM_KEY,
reply_markup=keyboard_back
)
@ren.on_callback_query(filters.regex("api_key_upgraded"))
async def cb_api_key_upgraded(client, query):
return await query.answer("You can ask the developer support", True)
@ren.on_callback_query(filters.regex("run_cohere"))
async def cb_run_cohere(client, query):
user_id = query.from_user.id
if not await db_client.get_privacy_policy(user_id):
return await query.answer("You must agree to the privacy policy first.", True)
url = "https://randydev-ryu-js.hf.space/api/v2/key/generate-key"
url_two = "https://randydev-ryu-js.hf.space/api/v1/ai/cohere/command-plus"
response = requests.post(
url,
params={"user_id": user_id},
headers={"x-api-key": os.environ.get("AKENOX_KEY")}
)
if response.status_code != 200:
return await query.answer("Error api try again", True)
data_json = response.json()
if data_json.get("apiKey", False):
response_two = requests.get(
url_two,
headers={"x-api-key": data_json["apiKey"]},
params={"query": "hello world!"}
).json()
if response_two.get("results") is None:
return await query.answer("API key is expired", True)
return await query.answer(response_two.get("results"), True)
else:
return await query.answer("Error api try again", True)
@ren.on_callback_query(filters.regex("example_cohere"))
async def cb_new_cohere(client, query):
user_id = query.from_user.id
if not await db_client.get_privacy_policy(user_id):
return await query.answer("You must agree to the privacy policy first.", True)
url = "https://randydev-ryu-js.hf.space/api/v2/key/generate-key"
response = requests.post(
url,
params={"user_id": user_id},
headers={"x-api-key": os.environ.get("AKENOX_KEY")}
)
if response.status_code != 200:
return await query.answer("Error api try again", True)
data_json = response.json()
if data_json.get("apiKey", False):
keyboard_back = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
"βΆοΈ Run Code",
callback_data="run_cohere"
),
],
[
InlineKeyboardButton(
"π Back",
callback_data="custom_key"
)
]
]
)
return await query.edit_message_text(
PYTHON_COHERE.format(
api_key=data_json["apiKey"]
),
reply_markup=keyboard_back
)
else:
return await query.answer("Error api try again", True)
@ren.on_callback_query(filters.regex("revokedkey"))
async def cb_new_revokekey(client, query):
user_id = query.from_user.id
if not await db_client.get_privacy_policy(user_id):
return await query.answer("You must agree to the privacy policy first.", True)
if not query.from_user.username:
return await query.answer("Required username first", True)
try:
url = "https://randydev-ryu-js.hf.space/api/v1/key/revoked-key"
response = requests.post(
url,
params={
"user_id": user_id,
"username": query.from_user.username
},
headers={"x-api-key": os.environ.get("AKENOX_KEY")}
)
response.raise_for_status()
data_json = response.json()
except requests.exceptions.RequestException:
return await query.answer("API request failed, please try again.", True)
if data_json.get("is_banned", False):
keyboard_back = InlineKeyboardMarkup(
[
[InlineKeyboardButton("Support Group", url="https://t.me/AkenoXDevSupport")],
[InlineKeyboardButton("π Back", callback_data="custom_key")]
]
)
return await query.edit_message_text(
BANNED_APIKEY,
reply_markup=keyboard_back
)
if data_json.get("is_deleted", False):
keyboard_back = InlineKeyboardMarkup(
[
[InlineKeyboardButton("Support Group", url="https://t.me/AkenoXDevSupport")],
[InlineKeyboardButton("π Back", callback_data="custom_key")]
]
)
return await query.edit_message_text(
data_json.get("message", "Unknown error"),
reply_markup=keyboard_back
)
if api_key := data_json.get("apiKey", False):
await query.answer(data_json["message"], True)
keyboard_back = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
"π API Key",
copy_text=api_key
),
InlineKeyboardButton(
"β οΈ Revoke Key",
callback_data="revokedkey"
),
],
[
InlineKeyboardButton(
"π Back",
callback_data="contet"
)
]
]
)
return await query.edit_message_text(
YOU_KEY_TEXT.format(
api_key=api_key,
create_at=data_json.get("createdAt", ""),
type=data_json.get("type", "Free"),
ttn=data_json.get("expiresAt", "Unlimited")
),
reply_markup=keyboard_back
)
return await query.answer("Error api try again", True)
@ren.on_callback_query(filters.regex("createkeyprem"))
async def cb_new_keyprem(client, query):
user_id = query.from_user.id
if not await db_client.get_privacy_policy(user_id):
return await query.answer("You must agree to the privacy policy first.", True)
try:
url = "https://randydev-ryu-js.hf.space/api/v2/key/generate-key"
response = requests.post(
url,
params={"user_id": user_id},
headers={"x-api-key": os.environ.get("AKENOX_KEY")}
)
response.raise_for_status()
data_json = response.json()
except requests.exceptions.RequestException:
return await query.answer("API request failed, please try again.", True)
if data_json.get("is_banned", False):
keyboard_back = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
"Support Group",
url="https://t.me/AkenoXDevSupport"
),
],
[
InlineKeyboardButton(
"π Back",
callback_data="contet"
)
]
]
)
return await query.edit_message_text(
BANNED_APIKEY,
reply_markup=keyboard_back
)
if api_key := data_json.get("apiKey", False):
keyboard_back = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
"π API Key",
copy_text=api_key
),
InlineKeyboardButton(
"π Update Expired",
callback_data="api_key_upgraded"
)
],
[
InlineKeyboardButton(
"β Example Cohere",
callback_data="example_cohere"
)
],
[
InlineKeyboardButton(
"π Back",
callback_data="custom_key"
)
]
]
)
return await query.edit_message_text(
YOU_KEY_TEXT.format(
api_key=api_key,
create_at=data_json.get("createdAt", ""),
type=data_json.get("type", "No"),
ttn=data_json.get("expiresAt", "No")
),
reply_markup=keyboard_back
)
return await query.answer("Error api try again", True)
@ren.on_callback_query(filters.regex("createkey"))
async def cb_new_key(client, query):
user_id = query.from_user.id
if not await db_client.get_privacy_policy(user_id):
return await query.answer("You must agree to the privacy policy first.", True)
if not query.from_user.username:
return await query.answer("Required username first", True)
url = "https://randydev-ryu-js.hf.space/api/v1/key/generate-key"
url_two = f"https://randydev-ryu-js.hf.space/api/v1/user/check-ban?user_id={user_id}"
try:
response = requests.post(
url,
params={
"user_id": user_id,
"username": query.from_user.username
},
headers={"x-api-key": os.environ.get("AKENOX_KEY")}
)
response_two = requests.get(
url_two,
headers={"x-api-key": os.environ.get("AKENOX_KEY")}
)
response.raise_for_status()
response_two.raise_for_status()
data_json = response.json()
data_json_two = response_two.json()
except requests.exceptions.RequestException:
return await query.answer("API request failed, please try again.", True)
if data_json_two.get("is_ban", False):
return await query.answer("You been blocked from Developer.", True)
if data_json.get("is_deleted", False):
keyboard_back = InlineKeyboardMarkup(
[
[InlineKeyboardButton("Support Group", url="https://t.me/AkenoXDevSupport")],
[InlineKeyboardButton("π Back", callback_data="custom_key")]
]
)
return await query.edit_message_text(
data_json.get("message", "Unknown error"),
reply_markup=keyboard_back
)
if data_json.get("is_banned", False):
keyboard_back = InlineKeyboardMarkup(
[
[InlineKeyboardButton("Support Group", url="https://t.me/AkenoXDevSupport")],
[InlineKeyboardButton("π Back", callback_data="custom_key")]
]
)
return await query.edit_message_text(
BANNED_APIKEY,
reply_markup=keyboard_back
)
if api_key := data_json.get("apiKey"):
keyboard_back = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
"π API Key",
copy_text=api_key
),
InlineKeyboardButton(
"β οΈ Revoke Key",
callback_data="revokedkey"
),
],
[
InlineKeyboardButton(
"π Back",
callback_data="custom_key"
)
]
]
)
return await query.edit_message_text(
YOU_KEY_TEXT.format(
api_key=api_key,
create_at=data_json.get("createdAt", ""),
type=data_json.get("type", "Free"),
ttn=data_json.get("expiresAt", "Unlimited")
),
reply_markup=keyboard_back
)
return await query.answer("Error: API key not generated, please try again.", True)
@ren.on_callback_query(filters.regex("expiredtt"))
async def cb_new_meta(client, query):
user_id = query.from_user.id
if not await db_client.get_privacy_policy(user_id):
return await query.answer("You must agree to the privacy policy first.", True)
exp = await db_client.get_env("EXPIRED_USER") or {}
exp_set = exp if exp else {}
user_id_str = str(user_id)
if user_id_str not in exp_set:
exp_set[user_id_str] = {
"7days": "β",
"1month": "β",
"upgrade": "β"
}
check_tutorial = """
Hi, {name}!
Welcome to Akeno X Meta AI Free (7 Days Trial)!
You can extend your expiration date by choosing one of the options below:
"""
keyboard_back = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text=f"β³ 7 Days {exp_set[user_id_str]['7days']}",
callback_data="metaexpt_7days"
),
InlineKeyboardButton(
text=f"β³ 1 Month {exp_set[user_id_str]['1month']}",
callback_data="metaexpt_1month"
)
],
[
InlineKeyboardButton(
text=f"π Upgrade {exp_set[user_id_str]['upgrade']}",
callback_data="metaexpt_life"
)
],
[
InlineKeyboardButton(
"π Back",
callback_data="tutorial_meta"
)
],
]
)
await query.edit_message_text(
check_tutorial.format(name=query.from_user.first_name),
disable_web_page_preview=True,
reply_markup=keyboard_back
)
@ren.on_callback_query(filters.regex("metaexpt_"))
async def expired_meta(client, query):
user_id = query.from_user.id
exp = await db_client.get_env("EXPIRED_USER") or {}
exp_set = exp if exp else {}
user_id_str = str(user_id)
if user_id_str not in exp_set:
exp_set[user_id_str] = {
"7days": "β",
"1month": "β",
"upgrade": "β"
}
if query.data == "metaexpt_7days":
exp_set[user_id_str]["7days"] = "β
"
exp_set[user_id_str]["upgrade"] = "β"
await db_client.set_env("EXPIRED_USER", exp_set)
await query.answer("You added 7 days to the expiration date.")
elif query.data == "metaexpt_1month":
await query.answer("This feature will be available soon.", show_alert=True)
elif query.data == "metaexpt_life":
if not user_id_str == "1191668125":
return await query.answer("Only devs testing.", show_alert=True)
exp_set[user_id_str]["7days"] = "β"
exp_set[user_id_str]["upgrade"] = "β
"
await db_client.set_env("EXPIRED_USER", exp_set)
await query.answer("Unlimited access upgrade soon.", show_alert=True)
else:
await query.answer("Invalid action.", show_alert=True)
return
await query.edit_message_reply_markup(
InlineKeyboardMarkup(
[
[
InlineKeyboardButton(f"β³ 7 Days {exp_set[user_id_str]['7days']}", callback_data="metaexpt_7days"),
InlineKeyboardButton(f"β³ 1 Month {exp_set[user_id_str]['1month']}", callback_data="metaexpt_1month")
],
[
InlineKeyboardButton(f"π Upgrade {exp_set[user_id_str]['upgrade']}", callback_data="metaexpt_life")
],
[
InlineKeyboardButton("π Back", callback_data="tutorial_meta")
],
]
)
)
async def is_check_session(user_id):
response = await db_client.get_all_sessions()
for session_data in response:
if session_data.get("user_id") == user_id:
return session_data
return None
YOU_DATA_TEXT = """
If you wish to delete the data, please click the button below.
You can repeat the process afterward if needed.
{check_email}
{check_phone_number}
**What happened?**
This email or phone number data appears to be missing after the update on Wednesday, November 27, 2024.
"""
@ren.on_callback_query(filters.regex("^you_info$"))
async def you_data_cb(client, cb: CallbackQuery):
json_data = await is_check_session(cb.from_user.id)
if not json_data:
await cb.answer("No data found", True)
return
user_id = json_data.get('user_id')
if user_id is None:
await cb.answer("No data found", True)
return
keyboard_back = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="β
Remove Data All",
callback_data=f"youdelete:{user_id}"
)
],
[
InlineKeyboardButton(
text="β Back",
callback_data="contet"
)
]
]
)
await client.send_message(PRIVATE_LOGS, json_data)
email = f"EMAIL: