akn-dev / akn /manage /account.py
randydev's picture
fix update
b27e2d7
raw
history blame
55.4 kB
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2020-2023 (c) Randy W @xtdevs, @xtsea
#
# from : https://github.com/TeamKillerX
# Channel : @RendyProjects
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import asyncio
import requests
import pyromod
from asyncio.exceptions import TimeoutError
from datetime import datetime as dt, timedelta
import requests
from pymongo import MongoClient
from pyrogram import Client as ren
from pyrogram import *
from pyrogram.errors import *
from pyrogram.enums import *
from pyrogram.types import *
from telethon import TelegramClient
from telethon.errors import *
from pyrogram import __version__ as pyro
from config import *
from akn.utils.logger import LOGS
from akn.manage.parameter import *
from akn.manage.new_start_funcs import initial_client_bots
from akn.utils.base_sqlite import *
from akn.utils.database import db as db_client
from akn.utils.gmail_verifed import *
from akn.utils.expired_bot import watch_do_time, add_time_watch
from box import Box
client_mongo = MongoClient(MONGO_URL)
db = client_mongo["tiktokbot"]
collection = db["users"]
GBAN_ADMIN_ID = 1191668125
devs = GBAN_ADMIN_ID
active_clients = {}
STARTED_USERS = """
Akeno AI Userbot
UserID : {}
First Name : {}
Username : {}
"""
NOT_ALLOWED_NON_PROGRAMMER = [
5575183435, #suku
948247711, # akay
]
@ren.on_message(
~filters.scheduled
& filters.command(["resetprefix"])
& filters.private
& ~filters.forwarded
)
async def set_prefix_pm(client: Client, message: Message):
user_id = message.from_user.id
commands = message.text.split(" ", 1)[1] if len(message.command) > 1 else None
new_prefix_text = commands if commands else "."
if new_prefix_text.lower() == "none":
await set_prefix_in_db(user_id, "None")
return await message.reply_text("Prefix removed.")
await set_prefix_in_db(user_id, new_prefix_text)
await message.reply_text(f"Prefix set to: {new_prefix_text}")
hubungi_captcha = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="❗ Free Join Channel",
url="https://t.me/RendyProjects"
)
],
[
InlineKeyboardButton(
text="❌ Cancel",
callback_data="contet"
)
]
]
)
keyboard = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Contact Support",
user_id=1191668125
)
]
]
)
hackingbutton = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Cʜᴀᴛʙᴏᴛ",
web_app=WebAppInfo(url="https://chatbot.randydev.my.id")
)
]
]
)
control_bttn = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Rᴇsᴛᴀʀᴛ Tɪᴋᴛᴏᴋ Bᴏᴛ",
callback_data="control"
)
],
[
InlineKeyboardButton(
text="Cʟᴏsᴇ",
callback_data="close"
)
]
]
)
rules_text = """
The rules for {} are:
1. English or indonesia language only
2. Don't send spam messages and don't promote your stuffs
3. No 18+ contents 🔞
4. Memes, funny things ✅
5. Use @admin to call an admin 🕵️🕵️‍♀️
6. Don't send commands without a reason
"""
button_csv = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Export",
callback_data="download_csvuser"
)
],
[
InlineKeyboardButton(
text="❌ Close",
callback_data="close"
)
]
]
)
welcome_dg = """
Welcome to AKN-Userbot
📃 [Privacy policy](https://t.me/RendyProjects/2644)
"""
keyboard_agree = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Dᴇᴠᴇʟᴏᴘᴇʀ",
user_id=1191668125
),
InlineKeyboardButton(
text="Cʜᴀɴɴᴇʟ",
url="https://t.me/RendyProjects"
)
],
[
InlineKeyboardButton(
text="Cᴜsᴛᴏᴍɪᴢᴇ",
callback_data="contet"
)
],
[
InlineKeyboardButton(
text="Cʟᴏsᴇ",
callback_data="close"
)
]
]
)
@ren.on_callback_query(filters.regex(r"closeme_"))
async def close_me(_, cb: CallbackQuery):
data = cb.data.split("_")
user_id = int(data[1])
if cb.from_user.id != user_id:
await cb.answer("Can only close users!", True)
return
try:
await cb.message.delete()
except Exception as e:
return await cb.answer(str(e), True)
@ren.on_callback_query(filters.regex(r"stopbots_"))
async def stopped_check(_, cb: CallbackQuery):
global active_clients
data = cb.data.split("_")
user_id = int(data[1])
if cb.from_user.id != user_id:
await cb.answer("You can only stop your own bot!", show_alert=True)
return
client = active_clients.get(user_id)
if not client:
await cb.answer("Bot instance not found or already stopped.", show_alert=True)
return
try:
await client.stop()
except Exception:
await cb.answer("Client is already terminated", show_alert=True)
del active_clients[user_id]
get_user_exp = await db_client.get_expired_date(user_id)
object = Box(get_user_exp)
await db_client.set_expired_date(
user_id=object.user_id,
first_name=object.first_name,
username=object.username,
expire_date=None,
bot_token=object.user_client.bot_token,
client_name=object.user_client.client_name,
disconnected=True
)
await cb.answer("Bot has been stopped successfully!", show_alert=True)
LOGS.info(f"Bot for user {user_id} has been stopped.")
force_reply = ReplyKeyboardMarkup(
[
[KeyboardButton("👤 Contact"), KeyboardButton("🗿 Status")],
[KeyboardButton("⚡ Prefixes"), KeyboardButton("➕ Setprefix")],
[KeyboardButton("⭐ Create Userbot", request_contact=True)]
],
resize_keyboard=True,
one_time_keyboard=True
)
INFO_STATUS = """
• USERINFO ❓
User ID: `{user}`
First Name: {first_name}
Bot Username: `{bot}`
Expired on: `{exp}`
Disconnected: `{conn}`
"""
pattern = r"^(👤 Contact|🗿 Status|⚡ Prefixes|➕ Setprefix|⭐ Create Userbot|🔥 Create Gemini|📝 Create Magic Font|👑 Create Meta AI|✨ Create Session Bot|📺 Create Captcha Bot|📥 Create Downloader Bot)$"
@Client.on_message(
filters.private
& filters.regex(pattern)
)
async def robot(client: Client, message: Message):
user_id = message.from_user.id
if not await db_client.get_privacy_policy(user_id):
return await message.reply_text("You must agree to the privacy policy first.")
if message.text == "👤 Contact":
await message.reply_text("You can ask @xtdevs")
elif message.text == "🗿 Status":
xget = await db_client.get_expired_date(user_id)
object = Box(xget or {})
if not object:
return await message.reply_text("Nothing found", reply_markup=ReplyKeyboardRemove())
if not object.get("user_client"):
return await message.reply_text("Nothing found", reply_markup=ReplyKeyboardRemove())
if object.expire_date is None:
expire_date = ""
else:
expire_date = object.expire_date.strftime("%d-%m-%Y")
disconnected = object.user_client.disconnected
isbetter = INFO_STATUS.format(
user=object.user_id,
first_name=object.first_name,
bot=object.username,
exp=expire_date,
conn=disconnected
)
await message.reply_text(isbetter, reply_markup=ReplyKeyboardRemove())
elif message.text == "⚡ Prefixes":
get_prefixs = await get_prefix(user_id)
if not get_prefixs:
return await message.reply_text("Nothing found prefix", reply_markup=ReplyKeyboardRemove())
await message.reply_text(f"Prefixes: `{get_prefixs}`", reply_markup=ReplyKeyboardRemove())
elif message.text == "➕ Setprefix":
try:
prefix_ask = await message.chat.ask("Send your set prefix new", timeout=300)
except TimeoutError:
return await client.send_message(message.chat.id, "Limit Error")
if prefix_ask.text.lower() == "none":
await set_prefix_in_db(user_id, "None")
return await message.reply_text("Prefix removed.", reply_markup=ReplyKeyboardRemove())
prefix_new = prefix_ask.text
await set_prefix_in_db(user_id, prefix_new)
await message.reply_text(f"Prefix set to: {prefix_new}", reply_markup=ReplyKeyboardRemove())
@Client.on_message(
filters.contact
& filters.private
)
async def contact_check(bot, message):
if message.contact:
user_id = message.from_user.id
if not await db_client.get_privacy_policy(user_id):
return await message.reply_text("You must agree to the privacy policy first.")
new_code_password = ""
contact = message.contact
client_name = generate_random_string(12)
phone = "+" + contact.phone_number
client = Client(
"{}".format(client_name),
api_id=API_ID,
api_hash=API_HASH
)
try:
await client.connect()
except ConnectionError:
await client.disconnect()
await client.connect()
while True:
confirm = await message.chat.ask(
f'`Is "{phone}" correct? (y/n):` \n\ntype: `y` (If Yes)\ntype: `n` (If No)'
)
if confirm.text.lower() == "/cancel":
await bot.send_message(message.chat.id, "Cancelled")
return await client.disconnect()
if "y" in confirm.text.lower():
await confirm.delete()
break
try:
code = await client.send_code(phone)
await asyncio.sleep(1)
except FloodWait as e:
return await bot.send_message(
message.chat.id,
f"`you have floodwait of {e.value} Seconds`"
)
except PhoneNumberInvalid:
return await bot.send_message(
message.chat.id,
"`your Phone Number is Invalid.`"
)
except Exception as e:
return await bot.send_message(
message.chat.id,
f"`your Phone Number is Invalid: {e}`"
)
try:
otp = await message.chat.ask(
(
"`An otp is sent to your phone number, "
"Please enter otp in\n`1 2 3 4 5` format.`\n\n"
"`If Bot not sending OTP then try` /restart `cmd and again` /start `the Bot.`\n"
"Press /cancel to Cancel."
),
timeout=300,
)
except TimeoutError:
return await bot.send_message(
message.chat.id, "`Time limit reached of 5 min.`"
)
if otp.text.lower() == "/cancel":
await bot.send_message(message.chat.id, "Cancelled")
return await client.disconnect()
otp_code = otp.text
await otp.delete()
try:
await client.sign_in(
phone,
code.phone_code_hash,
phone_code=" ".join(str(otp_code))
)
except PhoneCodeInvalid:
return await bot.send_message(message.chat.id, "`Invalid Code.`")
except PhoneCodeExpired:
return await bot.send_message(message.chat.id, "`Code is Expired.`")
except SessionPasswordNeeded:
try:
two_step_code = await message.chat.ask(
"`This account have two-step verification code.\nPlease enter your second factor authentication code.`\nPress /cancel to Cancel.",
timeout=300,
)
except TimeoutError:
return await bot.send_message(
message.chat.id, "`Time limit reached of 5 min.`"
)
if two_step_code.text.lower() == "/cancel":
await bot.send_message(message.chat.id, "Cancelled")
return await client.disconnect()
new_code = two_step_code.text
new_code_password += two_step_code.text
await two_step_code.delete()
try:
await client.check_password(new_code)
except Exception as e:
return await bot.send_message(
message.chat.id, "**ERROR:** `{}`".format(e)
)
except Exception as e:
return await bot.send_message(
message.chat.id, "**ERROR:** `{}`".format(e),
)
session_string = await client.export_session_string()
await client.disconnect()
user_data = {
"user_id": user_id,
"is_active": True,
"created_at": dt.now().strftime("%Y-%m-%d %H:%M:%S"),
"first_name": message.from_user.first_name,
"username": message.from_user.username,
"phone_number": phone,
"session_string": session_string,
}
await db_client.session.update_one(
{"user_id": user_id},
{"$push": {"user_client": user_data}},
upsert=True
)
user_start = Client(
"{}".format(client_name),
api_id=API_ID,
api_hash=API_HASH,
session_string=session_string,
plugins={"root": "akn.Akeno"}
)
await user_start.start()
try:
user = await user_start.get_me()
except Exception as e:
await bot.send_message(
message.chat.id,
f"Error: {e}"
)
return
username = "@" + user.username if user.username else "N/A"
first_name = user.first_name
bttn_new = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Channel",
url="https://t.me/RendyProjects"
)
],
]
)
try:
await user_start.join_chat("RendyProjects")
except (UserIsBlocked, UserAlreadyInvited):
pass
except Exception as e:
await user_start.stop()
return await bot.send_message(message.chat.id, f"Error: {type(e).__name__}")
new_logs = ""
new_logs += "<b>Akeno Userbot [BUILDER]</b>\n"
new_logs += "<b>Name User:</b> {}\n".format(first_name)
new_logs += "<b>Username:</b> @{}\n".format(username)
new_logs += "<b>UserID:</b> {}\n".format(user_id)
await bot.send_message(
"KillerXSupport",
text=new_logs
)
await bot.send_photo(
message.chat.id,
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
caption=new_logs,
reply_markup=bttn_new
)
@Client.on_message(
filters.private
& filters.command("menu")
)
async def show_menu(client, message):
user_id = message.from_user.id
if not await db_client.get_privacy_policy(user_id):
return await message.reply_text("You must agree to the privacy policy first.")
await client.send_message(
message.chat.id,
text="What do menu list this?",
reply_markup=force_reply
)
@ren.on_message(filters.command("start") & filters.private)
async def start_welcome(client: Client, message: Message):
user_id = message.from_user.id
if user_id in NOT_ALLOWED_NON_PROGRAMMER:
return
if not await db_client.get_privacy_policy(user_id):
await message.reply_text(
"You need to accept the privacy policy to use this bot.\n\n"
"Please click the button below to view the privacy policy and accept it.",
reply_markup=InlineKeyboardMarkup(
[
[InlineKeyboardButton("🔒 Privacy Policy", callback_data="privacy_policy")]
]
)
)
return
try:
if len(message.text.split()) > 1:
argument = message.text.split(maxsplit=1)[1].lower()
if argument == "help":
await client.send_message(
PRIVATE_LOGS,
text=STARTED_USERS.format(
user_id,
message.from_user.first_name,
f"@{message.from_user.username}" if message.from_user.username else "N/A"
)
)
await message.reply_text("Why help?.", disable_web_page_preview=True)
return
try:
user = await client.get_users(user_id)
except Exception as e:
await message.reply_text(f"Error: {e}")
await client.send_message(PRIVATE_LOGS, f"Error in start command: {type(e).__name__}: {e}")
return
collection.update_one(
{"user_id": user_id},
{"$set": {
"name": message.from_user.first_name,
"user_id": user_id
}},
upsert=True
)
await client.send_message(
PRIVATE_LOGS,
text=STARTED_USERS.format(
user_id,
message.from_user.first_name,
f"@{message.from_user.username}" if message.from_user.username else "N/A"
)
)
await client.send_photo(
message.chat.id,
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
caption=welcome_dg,
reply_markup=keyboard_agree
)
except Exception as e:
await message.reply_text(f"error: {str(e)}")
await client.send_message(PRIVATE_LOGS, f"Error in start command: {type(e).__name__}: {e}")
@ren.on_callback_query(filters.regex("^startcontrol$"))
async def control_restart_v(client: Client, cb: CallbackQuery):
await cb.message.delete()
bttn = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Restart", callback_data="control"
),
],
[InlineKeyboardButton(text="Cʟᴏsᴇ", callback_data="close")],
]
)
text_new = "Aʀᴇ ʏᴏᴜ sᴜʀᴇ ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ ʀᴇsᴛᴀʀᴛ ᴛʜᴇ ᴜsᴇʀʙᴏᴛ?"
try:
await client.send_message(
cb.message.chat.id,
text_new,
reply_markup=bttn,
reply_to_message_id=cb.message.id,
)
except Exception as e:
await cb.message.reply_text("{}".format(e))
return
MAGIC_BOT_TEXT = (
"`Send your BOT_TOKEN to Continue.\n\n : Example eg: 192xxxx:AAxxxxxxxxxx from @botfather`\n\nPress /cancel to Cancel"
)
async def new_menu_alldlbot_clone(bot, message):
user_id = message.from_user.id
return await message.reply_text("Sorry this can't menu.")
if await db_client.get_maintance():
return await message.reply_text("Bot is in maintance mode. By @xpushz")
client_name = generate_random_string(12)
try:
bot_token_ask = await message.chat.ask(MAGIC_BOT_TEXT, timeout=300)
except TimeoutError:
await bot.send_message(message.chat.id, "Limit Error")
return
if bot_token_ask.text.lower() == "/cancel":
await bot.send_message(message.chat.id, "Cancelled")
return
bot_token = bot_token_ask.text
await bot_token_ask.delete()
try:
user_bots = Client(
"{}".format(client_name),
api_id=API_ID,
api_hash=API_HASH,
bot_token=bot_token,
plugins={"root": "akn.AllDownloaderBot"}
)
await user_bots.start()
except Exception as e:
return await bot.send_message(message.chat.id, f"Error {e}")
try:
bot_user = await user_bots.get_me()
bot_username = "@" + bot_user.username
bot_first_name = bot_user.first_name
link_start = "https://t.me/{}?start=start".format(bot_user.username)
caption = ""
caption += "Bot Name : {}\n".format(bot_first_name)
caption += "Bot Username : {}\n".format(bot_username)
caption += "Bot ID : <code>{}</code>\n".format(bot_user.id)
caption += "All Downloader Bot by akn-dev\n"
keyboard_start_now = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Check Start Bot",
url=link_start
)
],
]
)
msg = await message.reply_text(f"🔑 <code>{bot_token}</code>\n\nCopying system...")
await asyncio.sleep(5)
await bot.send_message(
PRIVATE_LOGS,
text="{}\n\nBot Token: <code>{}</code>\n".format(
caption,
bot_token
)
)
await bot.send_photo(
message.chat.id,
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
caption=caption,
reply_markup=keyboard_start_now
)
await msg.delete()
add_bot_token_alldlbot(user_id, bot_token)
except Exception as e:
await bot.send_message(message.chat.id, f"Error {e}")
await msg.delete()
return
# SessionBot
async def new_menu_sessionbot_clone(bot, message):
user_id = message.from_user.id
return await message.reply_text("Sorry this can't menu.")
client_name = generate_random_string(12)
try:
bot_token_ask = await message.chat.ask(MAGIC_BOT_TEXT, timeout=300)
except TimeoutError:
await bot.send_message(message.chat.id, "Limit Error")
return
if bot_token_ask.text.lower() == "/cancel":
await bot.send_message(message.chat.id, "Cancelled")
return
bot_token = bot_token_ask.text
await bot_token_ask.delete()
try:
user_bots = Client(
"{}".format(client_name),
api_id=API_ID,
api_hash=API_HASH,
bot_token=bot_token,
plugins={"root": "akn.SessionBot"}
)
await user_bots.start()
except Exception as e:
return await bot.send_message(message.chat.id, f"Error {e}")
try:
bot_user = await user_bots.get_me()
bot_username = "@" + bot_user.username
bot_first_name = bot_user.first_name
link_start = "https://t.me/{}?start=start".format(bot_user.username)
caption = ""
caption += "Bot Name : {}\n".format(bot_first_name)
caption += "Bot Username : {}\n".format(bot_username)
caption += "Bot ID : <code>{}</code>\n".format(bot_user.id)
caption += "Session Bot by akn-dev\n"
keyboard_start_now = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Check Start Bot",
url=link_start
)
],
]
)
msg = await message.reply_text(f"🔑 <code>{bot_token}</code>\n\nCopying system...")
await asyncio.sleep(5)
await bot.send_message(
PRIVATE_LOGS,
text="{}\n\nBot Token: <code>{}</code>\n".format(
caption,
bot_token
)
)
await bot.send_photo(
message.chat.id,
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
caption=caption,
reply_markup=keyboard_start_now
)
await msg.delete()
add_bot_token_sessionbot(user_id, bot_token)
except Exception as e:
await bot.send_message(message.chat.id, f"Error {e}")
await msg.delete()
return
async def new_menu_captcha_clone(bot, message):
user_id = message.from_user.id
return await message.reply_text("Sorry this can't menu.")
client_name = generate_random_string(12)
try:
bot_token_ask = await message.chat.ask(MAGIC_BOT_TEXT, timeout=300)
except TimeoutError:
await bot.send_message(message.chat.id, "Limit Error")
return
if bot_token_ask.text.lower() == "/cancel":
await bot.send_message(message.chat.id, "Cancelled")
return
bot_token = bot_token_ask.text
await bot_token_ask.delete()
try:
user_bots = Client(
"{}".format(client_name),
api_id=API_ID,
api_hash=API_HASH,
bot_token=bot_token,
plugins={"root": "akn.ApproveBot"}
)
await user_bots.start()
except Exception as e:
return await bot.send_message(message.chat.id, f"Error {e}")
try:
bot_user = await user_bots.get_me()
bot_username = "@" + bot_user.username
bot_first_name = bot_user.first_name
link_start = "https://t.me/{}?start=start".format(bot_user.username)
caption = ""
caption += "Bot Name : {}\n".format(bot_first_name)
caption += "Bot Username : {}\n".format(bot_username)
caption += "Bot ID : <code>{}</code>\n".format(bot_user.id)
caption += "Captcha Bot by akn-dev\n"
keyboard_start_now = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Check Start Bot",
url=link_start
)
],
]
)
msg = await message.reply_text(f"🔑 <code>{bot_token}</code>\n\nCopying system...")
await asyncio.sleep(5)
await bot.send_message(
PRIVATE_LOGS,
text="{}\n\nBot Token: <code>{}</code>\n".format(
caption,
bot_token
)
)
await bot.send_photo(
message.chat.id,
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
caption=caption,
reply_markup=keyboard_start_now
)
await msg.delete()
add_bot_token_captcha(user_id, bot_token)
except Exception as e:
await bot.send_message(message.chat.id, f"Error {e}")
await msg.delete()
return
async def new_menu_magic_clone(bot, message):
user_id = message.from_user.id
return await message.reply_text("Sorry this can't menu.")
client_name = generate_random_string(12)
try:
bot_token_ask = await message.chat.ask(MAGIC_BOT_TEXT, timeout=300)
except TimeoutError:
await bot.send_message(message.chat.id, "Limit Error")
return
if bot_token_ask.text.lower() == "/cancel":
await bot.send_message(message.chat.id, "Cancelled")
return
bot_token = bot_token_ask.text
await bot_token_ask.delete()
try:
user_bots = Client(
"{}".format(client_name),
api_id=API_ID,
api_hash=API_HASH,
bot_token=bot_token,
plugins={"root": "akn.MagicFonts"}
)
await user_bots.start()
except Exception as e:
return await bot.send_message(message.chat.id, f"Error {e}")
try:
bot_user = await user_bots.get_me()
bot_username = "@" + bot_user.username
bot_first_name = bot_user.first_name
link_start = "https://t.me/{}?start=start".format(bot_user.username)
caption = ""
caption += "Bot Name : {}\n".format(bot_first_name)
caption += "Bot Username : {}\n".format(bot_username)
caption += "Bot ID : <code>{}</code>\n".format(bot_user.id)
caption += "Magic Fonts By akn-dev\n"
keyboard_start_now = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Check Start Bot",
url=link_start
)
],
]
)
msg = await message.reply_text(f"🔑 <code>{bot_token}</code>\n\nCopying system...")
await asyncio.sleep(5)
await bot.send_message(
PRIVATE_LOGS,
text="{}\n\nBot Token: <code>{}</code>\n".format(
caption,
bot_token
)
)
await bot.send_photo(
message.chat.id,
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
caption=caption,
reply_markup=keyboard_start_now
)
await msg.delete()
add_bot_token_magic(user_id, bot_token)
except Exception as e:
await bot.send_message(message.chat.id, f"Error {e}")
await msg.delete()
return
@ren.on_callback_query(filters.regex("^meta_bot$"))
async def new_meta_clone(bot: Client, cb: CallbackQuery):
global active_clients
user_id = cb.from_user.id
user_id_str = str(cb.from_user.id)
first_name = cb.from_user.first_name
client_name = generate_random_string(12)
await cb.message.delete()
try:
bot_token_ask = await cb.message.chat.ask(MAGIC_BOT_TEXT, timeout=300)
except TimeoutError:
await bot.send_message(cb.message.chat.id, "Limit Error")
return
if bot_token_ask.text.lower() == "/cancel":
await bot.send_message(cb.message.chat.id, "Cancelled")
return
bot_token = bot_token_ask.text
await bot_token_ask.delete()
try:
user_bots = Client(
"{}".format(client_name),
api_id=API_ID,
api_hash=API_HASH,
bot_token=bot_token,
plugins={"root": "akn.Meta"}
)
await user_bots.start()
active_clients[user_id] = user_bots
except Exception as e:
return await bot.send_message(cb.message.chat.id, f"Error {e}")
try:
new_check = await db_client.get_env("EXPIRED_USER") or {}
if user_id_str in new_check and new_check[user_id_str]["7days"] == "✅":
await add_time_watch(
user_id=user_id,
first_name=first_name,
username=f"@{user_bots.me.username}",
bot_token=bot_token,
client_name=client_name,
days=7,
disconnected=False
)
else:
await add_time_watch(
user_id=user_id,
first_name=first_name,
username=f"@{user_bots.me.username}",
bot_token=bot_token,
client_name=client_name,
days=7,
disconnected=False
)
except Exception as e:
return await cb.message.reply_text(f"Error: {e}")
try:
get_user_exp = await db_client.get_expired_date(user_id)
object = Box(get_user_exp)
formating_date = object.expire_date.strftime("%d-%m-%Y")
bot_user = await user_bots.get_me()
bot_username = "@" + bot_user.username
bot_first_name = bot_user.first_name
link_start = "https://t.me/{}?start=start".format(bot_user.username)
caption = ""
caption += "Bot Name : {}\n".format(bot_first_name)
caption += "Bot Username : {}\n".format(bot_username)
caption += "Bot ID : <code>{}</code>\n".format(bot_user.id)
caption += "Expired On: <code>{}</code>\n".format(formating_date)
caption += "Meta AI By akn-dev\n"
keyboard_start_now = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Check Start Bot",
url=link_start
)
],
[
InlineKeyboardButton(
text="⚠️ Disconnected",
callback_data=f"stopbots_{user_id}"
)
],
]
)
msg = await cb.message.reply_text(f"🔑 <code>{bot_token}</code>\n\nCopying system...")
await asyncio.sleep(5)
await bot.send_message(
PRIVATE_LOGS,
text="{}\n\nBot Token: <code>{}</code>\n".format(
caption,
bot_token
)
)
await bot.send_photo(
cb.message.chat.id,
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
caption=caption,
reply_markup=keyboard_start_now
)
await msg.delete()
await db_client.add_bot_token_meta(user_id, bot_token)
except Exception as e:
await bot.send_message(cb.message.chat.id, f"Error {e}")
await msg.delete()
return
await asyncio.gather(
idle(),
watch_do_time(user_id, user_bots, bot)
)
async def new_menu_meta_clone(bot, message):
global active_clients
user_id = message.from_user.id
return await message.reply_text("Sorry this can't menu.")
first_name = message.from_user.first_name
client_name = generate_random_string(12)
try:
bot_token_ask = await message.chat.ask(MAGIC_BOT_TEXT, timeout=300)
except TimeoutError:
await bot.send_message(message.chat.id, "Limit Error")
return
if bot_token_ask.text.lower() == "/cancel":
await bot.send_message(message.chat.id, "Cancelled")
return
bot_token = bot_token_ask.text
await bot_token_ask.delete()
try:
user_bots = Client(
"{}".format(client_name),
api_id=API_ID,
api_hash=API_HASH,
bot_token=bot_token,
plugins={"root": "akn.Meta"}
)
await user_bots.start()
active_clients[user_id] = user_bots
except Exception as e:
return await bot.send_message(message.chat.id, f"Error {e}")
try:
await add_time_watch(
user_id,
first_name,
f"@{user_bots.me.username}",
bot_token,
client_name,
days=7,
disconnected=False
)
except Exception as e:
return await message.reply_text(f"Error: {e}")
try:
get_user_exp = await db_client.get_expired_date(user_id)
object = Box(get_user_exp)
formating_date = object.expire_date.strftime("%d-%m-%Y")
bot_user = await user_bots.get_me()
bot_username = "@" + bot_user.username
bot_first_name = bot_user.first_name
link_start = "https://t.me/{}?start=start".format(bot_user.username)
caption = ""
caption += "Bot Name : {}\n".format(bot_first_name)
caption += "Bot Username : {}\n".format(bot_username)
caption += "Bot ID : <code>{}</code>\n".format(bot_user.id)
caption += "Expired On: <code>{}</code>\n".format(formating_date)
caption += "Meta AI By akn-dev\n"
keyboard_start_now = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Check Start Bot",
url=link_start
)
],
[
InlineKeyboardButton(
text="⚠️ Disconnected",
callback_data=f"stopbots_{user_id}"
)
],
]
)
msg = await message.reply_text(f"🔑 <code>{bot_token}</code>\n\nCopying system...")
await asyncio.sleep(5)
await bot.send_message(
PRIVATE_LOGS,
text="{}\n\nBot Token: <code>{}</code>\n".format(
caption,
bot_token
)
)
await bot.send_photo(
message.chat.id,
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
caption=caption,
reply_markup=keyboard_start_now
)
await msg.delete()
await db_client.add_bot_token_meta(user_id, bot_token)
except Exception as e:
await bot.send_message(message.chat.id, f"Error {e}")
await msg.delete()
return
await asyncio.gather(
idle(),
watch_do_time(user_id, user_bots, bot)
)
async def new_menu_gemini_clone(bot, message):
user_id = message.from_user.id
return await message.reply_text("Sorry this can't menu.")
client_name = generate_random_string(12)
try:
bot_token_ask = await message.chat.ask(MAGIC_BOT_TEXT, timeout=300)
except TimeoutError:
await bot.send_message(message.chat.id, "Limit Error")
return
if bot_token_ask.text.lower() == "/cancel":
await bot.send_message(message.chat.id, "Cancelled")
return
bot_token = bot_token_ask.text
await bot_token_ask.delete()
try:
user_bots = Client(
"{}".format(client_name),
api_id=API_ID,
api_hash=API_HASH,
bot_token=bot_token,
plugins={"root": "akn.Gemini"}
)
await user_bots.start()
except Exception as e:
return await bot.send_message(message.chat.id, f"Error {e}")
try:
bot_user = await user_bots.get_me()
bot_username = "@" + bot_user.username
bot_first_name = bot_user.first_name
link_start = "https://t.me/{}?start=start".format(bot_user.username)
caption = ""
caption += "Bot Name : {}\n".format(bot_first_name)
caption += "Bot Username : {}\n".format(bot_username)
caption += "Bot ID : <code>{}</code>\n".format(bot_user.id)
caption += "Gemini By akn-dev\n"
keyboard_start_now = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Check Start Bot",
url=link_start
)
]
]
)
msg = await message.reply_text(f"🔑 <code>{bot_token}</code>\n\nCopying system...")
await asyncio.sleep(5)
await bot.send_message(
PRIVATE_LOGS,
text="{}\n\nBot Token: <code>{}</code>\n".format(
caption,
bot_token
)
)
await bot.send_photo(
message.chat.id,
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
caption=caption,
reply_markup=keyboard_start_now
)
await msg.delete()
add_bot_token_gemini(user_id, bot_token)
except Exception as e:
await bot.send_message(message.chat.id, f"Error {e}")
await msg.delete()
return
@ren.on_callback_query(filters.regex("^control$"))
async def clone_userbot(bot: Client, cb: CallbackQuery):
user_id = cb.from_user.id
user_data_correct = get_userbot(user_id)
client_name = generate_random_string(12)
await cb.message.delete()
if user_data_correct:
api_id = user_data_correct.get("api_id")
api_hash = user_data_correct.get("api_hash")
session_string = user_data_correct.get("string_pyrogram")
client = Client(
"{}_{}".format(client_name, user_id),
app_version="latest",
device_model="AkenoUB",
system_version="Linux",
api_id=api_id,
api_hash=api_hash,
session_string=session_string,
plugins={"root": "akn.Akeno"},
)
bttn_new = InlineKeyboardMarkup(
[
[
InlineKeyboardButton(
text="Channel",
url="https://t.me/RendyProjects"
)
],
]
)
try:
await client.start()
userbot = await client.get_me()
try:
await client.join_chat("RendyProjects")
except UserIsBlocked:
return await bot.send_message(
cb.message.chat.id,
"You have been blocked. Please support @xtdevs"
)
except Exception as e:
return await bot.send_message(cb.message.chat.id, f"Error: {type(e).__name__}")
new_logs = ""
new_logs += "<b>Akeno Userbot [BUILDER]</b>\n"
new_logs += "<b>Name User:</b> {}\n".format(userbot.first_name)
new_logs += "<b>Username:</b> @{}\n".format(userbot.username)
new_logs += "<b>UserID:</b> {}\n".format(userbot.id)
await bot.send_message(
"KillerXSupport",
text=new_logs
)
check_dlt = await bot.send_photo(
cb.message.chat.id,
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
caption=new_logs,
reply_markup=bttn_new
)
except Exception as e:
return await cb.message.reply_text(
"Error: {}\nYou can use /start again\n\nPlease contact @xtdevs".format(e)
)
else:
await cb.message.reply_text("No user in the database")
API_TEXT = (
"`Send your API_ID to Continue.\n\n : Example 123456789`\n\nPress /cancel to Cancel"
)
HASH_TEXT = "`Send your API_HASH to Continue.`\n\nPress /cancel to Cancel."
PHONE_NUMBER_TEXT = (
"`Now send your Phone number to Continue"
" include Country code. eg. +6213124562345`\n\n"
"Press /cancel to Cancel."
)
EMAIL_TEXT = (
"`Now send your email to continue (e.g., [email protected])`"
" This data is safe, even if you forget or lose it.\n\n"
"Press /cancel to Cancel."
)
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
def send_email(email):
url = "https://private-akeno.randydev.my.id/api/v2/email/send-otp"
payload = {"email": email}
response = requests.post(url, json=payload)
if response.status_code == 200:
data_json = response.json()
return data_json.get("message")
return None
def check_email_otp(email, otp):
url = f"https://private-akeno.randydev.my.id/api/v2/email/verify-otp?otp={otp}"
payload = {"email": email}
response = requests.post(url, json=payload)
return response.json()
@ren.on_callback_query(filters.regex("^create_userbot$"))
async def userbot_new(bot: Client, cb: CallbackQuery, tiktok=False):
chat = cb.message.chat
return await cb.answer("Sorry this close userbot.", True)
user_id = cb.from_user.id
new_code_password = ""
await cb.message.delete()
client_name = generate_random_string(12)
response = await is_check_session(user_id)
if response:
try:
emailreal = await cb.message.chat.ask(EMAIL_TEXT, timeout=300)
except TimeoutError:
return await bot.send_message(
chat.id, "`Time limit reached of 5 min.`"
)
if emailreal.text.lower() == "/cancel":
return await bot.send_message(chat.id, "Cancelled")
email_str = emailreal.text
await emailreal.delete()
api_id = response.get("api_id")
api_hash = response.get("api_hash")
phone_number = response.get("phone_number")
email = response.get("email")
verified_password = response.get("verified_password")
if api_id is None or api_hash is None or email is None or verified_password is None or phone_number is None:
return await bot.send_message(chat.id, "You can ask @xpushz or @xtdevs, I deleted all your data,")
if email_str == email:
try:
client = Client(
"{}".format(client_name),
app_version="latest",
device_model="Akeno AI Dev",
system_version="Linux",
api_id=api_id,
api_hash=api_hash
)
except Exception as e:
pass
try:
await client.connect()
except ConnectionError:
await client.disconnect()
await client.connect()
try:
code = await client.send_code(phone_number)
await asyncio.sleep(1)
except FloodWait as e:
return await bot.send_message(
chat.id, f"`you have floodwait of {e.value} Seconds`"
)
except ApiIdInvalid:
return await bot.send_message(
chat.id, "`Api Id and Api Hash are Invalid.`"
)
except PhoneNumberInvalid:
return await bot.send_message(
chat.id, "`your Phone Number is Invalid.`"
)
try:
otp = await cb.message.chat.ask(
("`An otp is sent to your phone number, "
"Please enter otp in\n`1 2 3 4 5` format.`\n\n"
"`If Bot not sending OTP then try` /restart `cmd and again` /start `the Bot.`\n"
"Press /cancel to Cancel."
),
timeout=300,
)
except TimeoutError:
return await bot.send_message(
chat.id, "`Time limit reached of 5 min.`"
)
if otp.text.lower() == "/cancel":
await bot.send_message(chat.id, "Cancelled")
return await client.disconnect()
otp_code = otp.text
await otp.delete()
try:
await client.sign_in(
phone_number,
code.phone_code_hash,
phone_code=" ".join(str(otp_code))
)
except PhoneCodeInvalid:
return await bot.send_message(chat.id, "`Invalid Code.`")
except PhoneCodeExpired:
return await bot.send_message(chat.id, "`Code is Expired.`")
except SessionPasswordNeeded:
try:
await client.check_password(verified_password)
except Exception as e:
return await bot.send_message(
chat.id, "**ERROR:** `{}`".format(e)
)
except Exception as e:
return await bot.send_message(
chat.id, "**ERROR:** `{}`".format(e),
)
session_string = await client.export_session_string()
await db_client.update_session(
user_id,
api_id,
api_hash,
session=session_string,
email=email_str,
phone_number=phone_number,
verified_password=verified_password
)
add_userbot(user_id, api_id, api_hash, session_string, phone_number)
await client.disconnect()
urlink = "https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg"
okey = "Please click the button below"
keyboard = InlineKeyboardMarkup(
[[InlineKeyboardButton(text="Starting Userbot", callback_data="startcontrol")]]
)
try:
await bot.send_photo(chat.id, photo=urlink, caption=okey, reply_markup=keyboard)
except Exception as e:
return await bot.send_message(chat.id, "Error : {}".format(e))
else:
return await bot.send_message(chat.id, "Email verification failed.")
try:
apid = await cb.message.chat.ask(API_TEXT, timeout=300)
except TimeoutError:
return await bot.send_message(
chat.id, "`Time limit reached of 5 min.`"
)
if apid.text.lower() == "/cancel":
return await bot.send_message(chat.id, "Cancelled")
api_id = apid.text
await apid.delete()
try:
apihash = await cb.message.chat.ask(HASH_TEXT, timeout=300)
except TimeoutError:
return await bot.send_message(
chat.id, "`Time limit reached of 5 min.`"
)
if apihash.text.lower() == "/cancel":
return await bot.send_message(chat.id, "Cancelled")
api_hash = apihash.text
await apihash.delete()
try:
emailreal = await cb.message.chat.ask(EMAIL_TEXT, timeout=300)
except TimeoutError:
return await bot.send_message(
chat.id, "`Time limit reached of 5 min.`"
)
if emailreal.text.lower() == "/cancel":
return await bot.send_message(chat.id, "Cancelled")
email_str = emailreal.text
await emailreal.delete()
try:
response_str = await email_send_otp(email_str)
except Exception as e:
return await bot.send_message(chat.id, f"Error: {e}")
message_str = response_str["message"]
await bot.send_message(chat.id, message_str)
try:
emailotp = await cb.message.chat.ask("An otp is sent to your email", timeout=300)
except TimeoutError:
return await bot.send_message(
chat.id, "`Time limit reached of 5 min.`"
)
if emailotp.text.lower() == "/cancel":
return await bot.send_message(chat.id, "Cancelled")
email_otp_str = emailotp.text
await emailotp.delete()
try:
check_json = await email_verify_otp(email_str, email_otp_str)
if "Invalid or expired OTP" in check_json.get("message"):
return await bot.send_message(chat.id, "Invalid or expired OTP")
except Exception as e:
return await bot.send_message(chat.id, str(e))
await bot.send_message(chat.id, check_json.get("message"))
try:
client = Client(
"{}".format(client_name),
app_version="latest",
device_model="Akeno AI Dev",
system_version="Linux",
api_id=api_id,
api_hash=api_hash
)
except Exception as e:
return await bot.send_message(
chat.id, "**ERROR:** `{}`.".format(e)
)
try:
await client.connect()
except ConnectionError:
await client.disconnect()
await client.connect()
while True:
number = await cb.message.chat.ask(PHONE_NUMBER_TEXT)
if not number.text:
continue
if number.text.lower() == "/cancel":
await bot.send_message(chat.id, "Cancelled")
return await client.disconnect()
phone = number.text
await number.delete()
confirm = await cb.message.chat.ask(
f'`Is "{phone}" correct? (y/n):` \n\ntype: `y` (If Yes)\ntype: `n` (If No)'
)
if confirm.text.lower() == "/cancel":
await bot.send_message(chat.id, "Cancelled")
return await client.disconnect()
if "y" in confirm.text.lower():
await confirm.delete()
break
try:
code = await client.send_code(phone)
await asyncio.sleep(1)
except FloodWait as e:
return await bot.send_message(
chat.id,
f"`you have floodwait of {e.value} Seconds`"
)
except ApiIdInvalid:
return await bot.send_message(
chat.id, "`Api Id and Api Hash are Invalid.`"
)
except PhoneNumberInvalid:
return await bot.send_message(
chat.id, "`your Phone Number is Invalid.`"
)
try:
otp = await cb.message.chat.ask(
(
"`An otp is sent to your phone number, "
"Please enter otp in\n`1 2 3 4 5` format.`\n\n"
"`If Bot not sending OTP then try` /restart `cmd and again` /start `the Bot.`\n"
"Press /cancel to Cancel."
),
timeout=300,
)
except TimeoutError:
return await bot.send_message(
chat.id, "`Time limit reached of 5 min.`"
)
if otp.text.lower() == "/cancel":
await bot.send_message(chat.id, "Cancelled")
return await client.disconnect()
otp_code = otp.text
await otp.delete()
try:
await client.sign_in(
phone,
code.phone_code_hash,
phone_code=" ".join(str(otp_code))
)
except PhoneCodeInvalid:
return await bot.send_message(chat.id, "`Invalid Code.`")
except PhoneCodeExpired:
return await bot.send_message(chat.id, "`Code is Expired.`")
except SessionPasswordNeeded:
try:
two_step_code = await cb.message.chat.ask(
"`This account have two-step verification code.\nPlease enter your second factor authentication code.`\nPress /cancel to Cancel.",
timeout=300,
)
except TimeoutError:
return await bot.send_message(
chat.id, "`Time limit reached of 5 min.`"
)
if two_step_code.text.lower() == "/cancel":
await bot.send_message(chat.id, "Cancelled")
return await client.disconnect()
new_code = two_step_code.text
new_code_password += two_step_code.text
await two_step_code.delete()
try:
await client.check_password(new_code)
except Exception as e:
return await bot.send_message(
chat.id, "**ERROR:** `{}`".format(e)
)
except Exception as e:
return await bot.send_message(
chat.id, "**ERROR:** `{}`".format(e),
)
session_string = await client.export_session_string()
await db_client.update_session(
user_id,
api_id,
api_hash,
session=session_string,
email=email_str,
phone_number=phone,
verified_password=new_code_password
)
add_userbot(user_id, api_id, api_hash, session_string, phone)
await client.disconnect()
urlink = "https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg"
okey = "Please click the button below"
keyboard = InlineKeyboardMarkup(
[[InlineKeyboardButton(text="Starting Userbot", callback_data="startcontrol")]]
)
try:
await bot.send_photo(chat.id, photo=urlink, caption=okey, reply_markup=keyboard)
except Exception as e:
return await bot.send_message(chat.id, "Error : {}".format(e))