akenohub / main.py
randydev's picture
Update main.py
16f2403 verified
raw
history blame
18.1 kB
import logging
import time
import os
import requests
from pyrogram import Client, filters
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
from pyrogram.types import *
from pyrogram.errors import *
from pyrogram.enums import *
import akenoai as ak
from config import API_KEY, API_ID, API_HASH, BOT_TOKEN
from scripts import progress
logging.basicConfig(
level=logging.WARNING, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)
logging.getLogger("pyrogram").setLevel(logging.WARNING)
WELCOME_TEXT = """
Hey! {first_name}
Saya adalah bot untuk mengunduh video PornoHub di telegram.
- Jangan share video ke group (mending private bot aman)
- Command: /hubsearch boobs
- Command: /hubdl link xnxx
- Command: /freemode
- command: /check_status
Powered by @xtdevs
"""
client = Client(
"Ryzenth",
api_id=API_ID,
api_hash=API_HASH,
bot_token=BOT_TOKEN
)
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)
```
"""
BANNED_APIKEY = """
You have <b>been banned and can no longer create an API key.</b>
<b>Reason:</b> <code>Previous issues occurred again.</code>
<blockquote>
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.
</blockquote>
"""
YOU_KEY_TEXT = """
AkenoX API Key Generated
πŸ”‘ **API Key:** <spoiler>{api_key}</spoiler>
βš”οΈ **Type Key:** <code>{type}</code>
βŒ› **Expired:** <code>{ttn}</code>
πŸ“… **Created At:** <code>{create_at}</code>
⚠️ **Warning:** Do not share this token with anyone!
"""
CUSTOM_KEY = """
**Welcome to Ryzenth 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.
"""
@client.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
)
@client.on_callback_query(filters.regex("^custom_ban"))
async def cb_custom_bans(client, query):
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
)
@client.on_callback_query(filters.regex("^custom_key"))
async def cb_custom_key(client, query):
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(
"❌ Close",
callback_data="close"
)
]
]
)
return await query.edit_message_text(
text=CUSTOM_KEY,
reply_markup=keyboard_back
)
@client.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="close"
)
]
]
)
await query.edit_message_text(
text=resonse_data["message"],
reply_markup=keyboard_back
)
@Client.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)
@client.on_callback_query(filters.regex("run_cohere"))
async def cb_run_cohere(client, query):
user_id = query.from_user.id
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)
@client.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)
@client.on_callback_query(filters.regex("revokedkey"))
async def cb_new_revokekey(client, query):
user_id = query.from_user.id
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="close"
)
]
]
)
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)
@client.on_callback_query(filters.regex("createkeyprem"))
async def cb_new_keyprem(client, query):
user_id = query.from_user.id
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"
),
]
]
)
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)
@client.on_callback_query(filters.regex("createkey"))
async def cb_new_key(client, query):
user_id = query.from_user.id
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)
@client.on_message(
filters.incoming
& filters.command("start")
& filters.private
)
async def welcome_start(client: Client, message: Message):
keyboard = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="πŸ†• Get API Key",
callback_data="custom_key"
)
]
]
)
await message.reply_text(
WELCOME_TEXT.format(
first_name=message.from_user.first_name
),
reply_markup=keyboard
)
client.run()