Upload account.py
Browse files- akn/manage/account.py +51 -958
akn/manage/account.py
CHANGED
@@ -23,34 +23,31 @@ import pyromod
|
|
23 |
from asyncio.exceptions import TimeoutError
|
24 |
from datetime import datetime as dt, timedelta
|
25 |
|
26 |
-
import requests
|
27 |
from pymongo import MongoClient
|
|
|
28 |
from pyrogram import Client as ren
|
29 |
from pyrogram import *
|
30 |
from pyrogram.errors import *
|
31 |
from pyrogram.enums import *
|
32 |
-
|
33 |
from pyrogram.types import *
|
|
|
|
|
34 |
from telethon import TelegramClient
|
35 |
from telethon.errors import *
|
36 |
-
from pyrogram import __version__ as pyro
|
37 |
|
38 |
-
from config import *
|
39 |
from akn.utils.logger import LOGS
|
40 |
from akn.manage.parameter import *
|
41 |
from akn.manage.new_start_funcs import initial_client_bots
|
42 |
from akn.utils.base_sqlite import *
|
43 |
from akn.utils.database import db as db_client
|
44 |
-
from akn.utils.gmail_verifed import *
|
45 |
from akn.utils.expired_bot import watch_do_time, add_time_watch
|
|
|
46 |
from box import Box
|
47 |
|
48 |
client_mongo = MongoClient(MONGO_URL)
|
49 |
db = client_mongo["tiktokbot"]
|
50 |
collection = db["users"]
|
51 |
|
52 |
-
TOPIC_CHAT = "AkenoXDevSupport"
|
53 |
-
TOPIC_IDS = 23159
|
54 |
GBAN_ADMIN_ID = 1191668125
|
55 |
devs = GBAN_ADMIN_ID
|
56 |
|
@@ -64,11 +61,6 @@ First Name : {}
|
|
64 |
Username : {}
|
65 |
"""
|
66 |
|
67 |
-
NOT_ALLOWED_NON_PROGRAMMER = [
|
68 |
-
5575183435, #suku
|
69 |
-
948247711, # akay
|
70 |
-
]
|
71 |
-
|
72 |
@ren.on_message(
|
73 |
~filters.scheduled
|
74 |
& filters.command(["resetprefix"])
|
@@ -113,17 +105,6 @@ keyboard = InlineKeyboardMarkup(
|
|
113 |
]
|
114 |
)
|
115 |
|
116 |
-
hackingbutton = InlineKeyboardMarkup(
|
117 |
-
[
|
118 |
-
[
|
119 |
-
InlineKeyboardButton(
|
120 |
-
text="Cʜᴀᴛʙᴏᴛ",
|
121 |
-
web_app=WebAppInfo(url="https://chatbot.randydev.my.id")
|
122 |
-
)
|
123 |
-
]
|
124 |
-
]
|
125 |
-
)
|
126 |
-
|
127 |
control_bttn = InlineKeyboardMarkup(
|
128 |
[
|
129 |
[
|
@@ -141,17 +122,6 @@ control_bttn = InlineKeyboardMarkup(
|
|
141 |
]
|
142 |
)
|
143 |
|
144 |
-
rules_text = """
|
145 |
-
The rules for {} are:
|
146 |
-
|
147 |
-
1. English or indonesia language only
|
148 |
-
2. Don't send spam messages and don't promote your stuffs
|
149 |
-
3. No 18+ contents 🔞
|
150 |
-
4. Memes, funny things ✅
|
151 |
-
5. Use @admin to call an admin 🕵️🕵️♀️
|
152 |
-
6. Don't send commands without a reason
|
153 |
-
"""
|
154 |
-
|
155 |
button_csv = InlineKeyboardMarkup(
|
156 |
[
|
157 |
[
|
@@ -269,7 +239,7 @@ Expired on: `{exp}`
|
|
269 |
Disconnected: `{conn}`
|
270 |
"""
|
271 |
|
272 |
-
pattern = r"^(👤 Contact|🗿 Status|⚡ Prefixes|➕ Setprefix|⭐ Create Userbot
|
273 |
|
274 |
@Client.on_message(
|
275 |
filters.private
|
@@ -539,9 +509,6 @@ async def show_menu(client, message):
|
|
539 |
async def start_welcome(client: Client, message: Message):
|
540 |
user_id = message.from_user.id
|
541 |
|
542 |
-
if user_id in NOT_ALLOWED_NON_PROGRAMMER:
|
543 |
-
return
|
544 |
-
|
545 |
if not await db_client.get_privacy_policy(user_id):
|
546 |
await message.reply_text(
|
547 |
"You need to accept the privacy policy to use this bot.\n\n"
|
@@ -586,15 +553,13 @@ async def start_welcome(client: Client, message: Message):
|
|
586 |
)
|
587 |
|
588 |
await client.send_message(
|
589 |
-
|
590 |
text=STARTED_USERS.format(
|
591 |
user_id,
|
592 |
message.from_user.first_name,
|
593 |
f"@{message.from_user.username}" if message.from_user.username else "N/A"
|
594 |
-
)
|
595 |
-
message_thread_id=TOPIC_IDS
|
596 |
)
|
597 |
-
|
598 |
await client.send_photo(
|
599 |
message.chat.id,
|
600 |
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
|
@@ -604,49 +569,22 @@ async def start_welcome(client: Client, message: Message):
|
|
604 |
except Exception as e:
|
605 |
await message.reply_text(f"error: {str(e)}")
|
606 |
await client.send_message(PRIVATE_LOGS, f"Error in start command: {type(e).__name__}: {e}")
|
607 |
-
|
608 |
-
@ren.on_callback_query(filters.regex("^startcontrol$"))
|
609 |
-
async def control_restart_v(client: Client, cb: CallbackQuery):
|
610 |
-
await cb.message.delete()
|
611 |
-
bttn = InlineKeyboardMarkup(
|
612 |
-
[
|
613 |
-
[
|
614 |
-
InlineKeyboardButton(
|
615 |
-
text="Restart", callback_data="control"
|
616 |
-
),
|
617 |
-
],
|
618 |
-
[InlineKeyboardButton(text="Cʟᴏsᴇ", callback_data="close")],
|
619 |
-
]
|
620 |
-
)
|
621 |
-
text_new = "Aʀᴇ ʏᴏᴜ sᴜʀᴇ ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ ʀᴇsᴛᴀʀᴛ ᴛʜᴇ ᴜsᴇʀʙᴏᴛ?"
|
622 |
-
try:
|
623 |
-
await client.send_message(
|
624 |
-
cb.message.chat.id,
|
625 |
-
text_new,
|
626 |
-
reply_markup=bttn,
|
627 |
-
reply_to_message_id=cb.message.id,
|
628 |
-
)
|
629 |
-
except Exception as e:
|
630 |
-
await cb.message.reply_text("{}".format(e))
|
631 |
-
return
|
632 |
-
|
633 |
-
MAGIC_BOT_TEXT = (
|
634 |
-
"`Send your BOT_TOKEN to Continue.\n\n : Example eg: 192xxxx:AAxxxxxxxxxx from @botfather`\n\nPress /cancel to Cancel"
|
635 |
-
)
|
636 |
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
|
|
642 |
client_name = generate_random_string(12)
|
|
|
643 |
try:
|
644 |
-
bot_token_ask = await message.chat.ask(MAGIC_BOT_TEXT, timeout=300)
|
645 |
except TimeoutError:
|
646 |
-
await bot.send_message(message.chat.id, "Limit Error")
|
647 |
return
|
648 |
if bot_token_ask.text.lower() == "/cancel":
|
649 |
-
await bot.send_message(message.chat.id, "Cancelled")
|
650 |
return
|
651 |
bot_token = bot_token_ask.text
|
652 |
await bot_token_ask.delete()
|
@@ -656,147 +594,40 @@ async def new_menu_alldlbot_clone(bot, message):
|
|
656 |
api_id=API_ID,
|
657 |
api_hash=API_HASH,
|
658 |
bot_token=bot_token,
|
659 |
-
plugins={"root": "akn.
|
660 |
)
|
661 |
await user_bots.start()
|
|
|
662 |
except Exception as e:
|
663 |
-
return await bot.send_message(message.chat.id, f"Error {e}")
|
664 |
try:
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
[
|
676 |
-
[
|
677 |
-
InlineKeyboardButton(
|
678 |
-
text="Check Start Bot",
|
679 |
-
url=link_start
|
680 |
-
)
|
681 |
-
],
|
682 |
-
]
|
683 |
-
)
|
684 |
-
msg = await message.reply_text(f"🔑 <code>{bot_token}</code>\n\nCopying system...")
|
685 |
-
await asyncio.sleep(5)
|
686 |
-
await bot.send_message(
|
687 |
-
PRIVATE_LOGS,
|
688 |
-
text="{}\n\nBot Token: <code>{}</code>\n".format(
|
689 |
-
caption,
|
690 |
-
bot_token
|
691 |
)
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
except Exception as e:
|
702 |
-
await bot.send_message(message.chat.id, f"Error {e}")
|
703 |
-
await msg.delete()
|
704 |
-
return
|
705 |
-
|
706 |
-
# SessionBot
|
707 |
-
async def new_menu_sessionbot_clone(bot, message):
|
708 |
-
user_id = message.from_user.id
|
709 |
-
return await message.reply_text("Sorry this can't menu.")
|
710 |
-
client_name = generate_random_string(12)
|
711 |
-
try:
|
712 |
-
bot_token_ask = await message.chat.ask(MAGIC_BOT_TEXT, timeout=300)
|
713 |
-
except TimeoutError:
|
714 |
-
await bot.send_message(message.chat.id, "Limit Error")
|
715 |
-
return
|
716 |
-
if bot_token_ask.text.lower() == "/cancel":
|
717 |
-
await bot.send_message(message.chat.id, "Cancelled")
|
718 |
-
return
|
719 |
-
bot_token = bot_token_ask.text
|
720 |
-
await bot_token_ask.delete()
|
721 |
-
try:
|
722 |
-
user_bots = Client(
|
723 |
-
"{}".format(client_name),
|
724 |
-
api_id=API_ID,
|
725 |
-
api_hash=API_HASH,
|
726 |
-
bot_token=bot_token,
|
727 |
-
plugins={"root": "akn.SessionBot"}
|
728 |
-
)
|
729 |
-
await user_bots.start()
|
730 |
-
except Exception as e:
|
731 |
-
return await bot.send_message(message.chat.id, f"Error {e}")
|
732 |
-
try:
|
733 |
-
bot_user = await user_bots.get_me()
|
734 |
-
bot_username = "@" + bot_user.username
|
735 |
-
bot_first_name = bot_user.first_name
|
736 |
-
link_start = "https://t.me/{}?start=start".format(bot_user.username)
|
737 |
-
caption = ""
|
738 |
-
caption += "Bot Name : {}\n".format(bot_first_name)
|
739 |
-
caption += "Bot Username : {}\n".format(bot_username)
|
740 |
-
caption += "Bot ID : <code>{}</code>\n".format(bot_user.id)
|
741 |
-
caption += "Session Bot by akn-dev\n"
|
742 |
-
keyboard_start_now = InlineKeyboardMarkup(
|
743 |
-
[
|
744 |
-
[
|
745 |
-
InlineKeyboardButton(
|
746 |
-
text="Check Start Bot",
|
747 |
-
url=link_start
|
748 |
-
)
|
749 |
-
],
|
750 |
-
]
|
751 |
-
)
|
752 |
-
msg = await message.reply_text(f"🔑 <code>{bot_token}</code>\n\nCopying system...")
|
753 |
-
await asyncio.sleep(5)
|
754 |
-
await bot.send_message(
|
755 |
-
PRIVATE_LOGS,
|
756 |
-
text="{}\n\nBot Token: <code>{}</code>\n".format(
|
757 |
-
caption,
|
758 |
-
bot_token
|
759 |
)
|
760 |
-
)
|
761 |
-
await bot.send_photo(
|
762 |
-
message.chat.id,
|
763 |
-
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
|
764 |
-
caption=caption,
|
765 |
-
reply_markup=keyboard_start_now
|
766 |
-
)
|
767 |
-
await msg.delete()
|
768 |
-
add_bot_token_sessionbot(user_id, bot_token)
|
769 |
-
except Exception as e:
|
770 |
-
await bot.send_message(message.chat.id, f"Error {e}")
|
771 |
-
await msg.delete()
|
772 |
-
return
|
773 |
-
|
774 |
-
async def new_menu_captcha_clone(bot, message):
|
775 |
-
user_id = message.from_user.id
|
776 |
-
return await message.reply_text("Sorry this can't menu.")
|
777 |
-
client_name = generate_random_string(12)
|
778 |
-
try:
|
779 |
-
bot_token_ask = await message.chat.ask(MAGIC_BOT_TEXT, timeout=300)
|
780 |
-
except TimeoutError:
|
781 |
-
await bot.send_message(message.chat.id, "Limit Error")
|
782 |
-
return
|
783 |
-
if bot_token_ask.text.lower() == "/cancel":
|
784 |
-
await bot.send_message(message.chat.id, "Cancelled")
|
785 |
-
return
|
786 |
-
bot_token = bot_token_ask.text
|
787 |
-
await bot_token_ask.delete()
|
788 |
-
try:
|
789 |
-
user_bots = Client(
|
790 |
-
"{}".format(client_name),
|
791 |
-
api_id=API_ID,
|
792 |
-
api_hash=API_HASH,
|
793 |
-
bot_token=bot_token,
|
794 |
-
plugins={"root": "akn.ApproveBot"}
|
795 |
-
)
|
796 |
-
await user_bots.start()
|
797 |
except Exception as e:
|
798 |
-
return await
|
799 |
try:
|
|
|
|
|
|
|
800 |
bot_user = await user_bots.get_me()
|
801 |
bot_username = "@" + bot_user.username
|
802 |
bot_first_name = bot_user.first_name
|
@@ -805,7 +636,8 @@ async def new_menu_captcha_clone(bot, message):
|
|
805 |
caption += "Bot Name : {}\n".format(bot_first_name)
|
806 |
caption += "Bot Username : {}\n".format(bot_username)
|
807 |
caption += "Bot ID : <code>{}</code>\n".format(bot_user.id)
|
808 |
-
caption += "
|
|
|
809 |
keyboard_start_now = InlineKeyboardMarkup(
|
810 |
[
|
811 |
[
|
@@ -814,76 +646,15 @@ async def new_menu_captcha_clone(bot, message):
|
|
814 |
url=link_start
|
815 |
)
|
816 |
],
|
817 |
-
]
|
818 |
-
)
|
819 |
-
msg = await message.reply_text(f"🔑 <code>{bot_token}</code>\n\nCopying system...")
|
820 |
-
await asyncio.sleep(5)
|
821 |
-
await bot.send_message(
|
822 |
-
PRIVATE_LOGS,
|
823 |
-
text="{}\n\nBot Token: <code>{}</code>\n".format(
|
824 |
-
caption,
|
825 |
-
bot_token
|
826 |
-
)
|
827 |
-
)
|
828 |
-
await bot.send_photo(
|
829 |
-
message.chat.id,
|
830 |
-
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
|
831 |
-
caption=caption,
|
832 |
-
reply_markup=keyboard_start_now
|
833 |
-
)
|
834 |
-
await msg.delete()
|
835 |
-
add_bot_token_captcha(user_id, bot_token)
|
836 |
-
except Exception as e:
|
837 |
-
await bot.send_message(message.chat.id, f"Error {e}")
|
838 |
-
await msg.delete()
|
839 |
-
return
|
840 |
-
|
841 |
-
async def new_menu_magic_clone(bot, message):
|
842 |
-
user_id = message.from_user.id
|
843 |
-
return await message.reply_text("Sorry this can't menu.")
|
844 |
-
client_name = generate_random_string(12)
|
845 |
-
try:
|
846 |
-
bot_token_ask = await message.chat.ask(MAGIC_BOT_TEXT, timeout=300)
|
847 |
-
except TimeoutError:
|
848 |
-
await bot.send_message(message.chat.id, "Limit Error")
|
849 |
-
return
|
850 |
-
if bot_token_ask.text.lower() == "/cancel":
|
851 |
-
await bot.send_message(message.chat.id, "Cancelled")
|
852 |
-
return
|
853 |
-
bot_token = bot_token_ask.text
|
854 |
-
await bot_token_ask.delete()
|
855 |
-
try:
|
856 |
-
user_bots = Client(
|
857 |
-
"{}".format(client_name),
|
858 |
-
api_id=API_ID,
|
859 |
-
api_hash=API_HASH,
|
860 |
-
bot_token=bot_token,
|
861 |
-
plugins={"root": "akn.MagicFonts"}
|
862 |
-
)
|
863 |
-
await user_bots.start()
|
864 |
-
except Exception as e:
|
865 |
-
return await bot.send_message(message.chat.id, f"Error {e}")
|
866 |
-
try:
|
867 |
-
bot_user = await user_bots.get_me()
|
868 |
-
bot_username = "@" + bot_user.username
|
869 |
-
bot_first_name = bot_user.first_name
|
870 |
-
link_start = "https://t.me/{}?start=start".format(bot_user.username)
|
871 |
-
caption = ""
|
872 |
-
caption += "Bot Name : {}\n".format(bot_first_name)
|
873 |
-
caption += "Bot Username : {}\n".format(bot_username)
|
874 |
-
caption += "Bot ID : <code>{}</code>\n".format(bot_user.id)
|
875 |
-
caption += "Magic Fonts By akn-dev\n"
|
876 |
-
keyboard_start_now = InlineKeyboardMarkup(
|
877 |
-
[
|
878 |
[
|
879 |
InlineKeyboardButton(
|
880 |
-
text="
|
881 |
-
|
882 |
)
|
883 |
],
|
884 |
]
|
885 |
)
|
886 |
-
msg = await message.reply_text(f"🔑 <code>{bot_token}</code>\n\nCopying system...")
|
887 |
await asyncio.sleep(5)
|
888 |
await bot.send_message(
|
889 |
PRIVATE_LOGS,
|
@@ -893,696 +664,18 @@ async def new_menu_magic_clone(bot, message):
|
|
893 |
)
|
894 |
)
|
895 |
await bot.send_photo(
|
896 |
-
message.chat.id,
|
897 |
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
|
898 |
caption=caption,
|
899 |
reply_markup=keyboard_start_now
|
900 |
)
|
901 |
await msg.delete()
|
902 |
-
|
903 |
except Exception as e:
|
904 |
-
await bot.send_message(message.chat.id, f"Error {e}")
|
905 |
-
await msg.delete()
|
906 |
-
return
|
907 |
-
|
908 |
-
@ren.on_callback_query(filters.regex("^meta_bot$"))
|
909 |
-
async def new_meta_clone(bot: Client, cb: CallbackQuery):
|
910 |
-
global active_clients
|
911 |
-
user_id = cb.from_user.id
|
912 |
-
user_id_str = str(cb.from_user.id)
|
913 |
-
first_name = cb.from_user.first_name
|
914 |
-
client_name = generate_random_string(12)
|
915 |
-
await cb.message.delete()
|
916 |
-
try:
|
917 |
-
bot_token_ask = await cb.message.chat.ask(MAGIC_BOT_TEXT, timeout=300)
|
918 |
-
except TimeoutError:
|
919 |
-
await bot.send_message(cb.message.chat.id, "Limit Error")
|
920 |
-
return
|
921 |
-
if bot_token_ask.text.lower() == "/cancel":
|
922 |
-
await bot.send_message(cb.message.chat.id, "Cancelled")
|
923 |
-
return
|
924 |
-
bot_token = bot_token_ask.text
|
925 |
-
await bot_token_ask.delete()
|
926 |
-
try:
|
927 |
-
user_bots = Client(
|
928 |
-
"{}".format(client_name),
|
929 |
-
api_id=API_ID,
|
930 |
-
api_hash=API_HASH,
|
931 |
-
bot_token=bot_token,
|
932 |
-
plugins={"root": "akn.Meta"}
|
933 |
-
)
|
934 |
-
await user_bots.start()
|
935 |
-
active_clients[user_id] = user_bots
|
936 |
-
except Exception as e:
|
937 |
-
return await bot.send_message(cb.message.chat.id, f"Error {e}")
|
938 |
-
try:
|
939 |
-
new_check = await db_client.get_env("EXPIRED_USER") or {}
|
940 |
-
if user_id_str in new_check and new_check[user_id_str]["7days"] == "✅":
|
941 |
-
await add_time_watch(
|
942 |
-
user_id=user_id,
|
943 |
-
first_name=first_name,
|
944 |
-
username=f"@{user_bots.me.username}",
|
945 |
-
bot_token=bot_token,
|
946 |
-
client_name=client_name,
|
947 |
-
days=7,
|
948 |
-
disconnected=False
|
949 |
-
)
|
950 |
-
else:
|
951 |
-
await add_time_watch(
|
952 |
-
user_id=user_id,
|
953 |
-
first_name=first_name,
|
954 |
-
username=f"@{user_bots.me.username}",
|
955 |
-
bot_token=bot_token,
|
956 |
-
client_name=client_name,
|
957 |
-
days=7,
|
958 |
-
disconnected=False
|
959 |
-
)
|
960 |
-
except Exception as e:
|
961 |
-
return await cb.message.reply_text(f"Error: {e}")
|
962 |
-
try:
|
963 |
-
get_user_exp = await db_client.get_expired_date(user_id)
|
964 |
-
object = Box(get_user_exp)
|
965 |
-
formating_date = object.expire_date.strftime("%d-%m-%Y")
|
966 |
-
bot_user = await user_bots.get_me()
|
967 |
-
bot_username = "@" + bot_user.username
|
968 |
-
bot_first_name = bot_user.first_name
|
969 |
-
link_start = "https://t.me/{}?start=start".format(bot_user.username)
|
970 |
-
caption = ""
|
971 |
-
caption += "Bot Name : {}\n".format(bot_first_name)
|
972 |
-
caption += "Bot Username : {}\n".format(bot_username)
|
973 |
-
caption += "Bot ID : <code>{}</code>\n".format(bot_user.id)
|
974 |
-
caption += "Expired On: <code>{}</code>\n".format(formating_date)
|
975 |
-
caption += "Meta AI By akn-dev\n"
|
976 |
-
keyboard_start_now = InlineKeyboardMarkup(
|
977 |
-
[
|
978 |
-
[
|
979 |
-
InlineKeyboardButton(
|
980 |
-
text="Check Start Bot",
|
981 |
-
url=link_start
|
982 |
-
)
|
983 |
-
],
|
984 |
-
[
|
985 |
-
InlineKeyboardButton(
|
986 |
-
text="⚠️ Disconnected",
|
987 |
-
callback_data=f"stopbots_{user_id}"
|
988 |
-
)
|
989 |
-
],
|
990 |
-
]
|
991 |
-
)
|
992 |
-
msg = await cb.message.reply_text(f"🔑 <code>{bot_token}</code>\n\nCopying system...")
|
993 |
-
await asyncio.sleep(5)
|
994 |
-
await bot.send_message(
|
995 |
-
PRIVATE_LOGS,
|
996 |
-
text="{}\n\nBot Token: <code>{}</code>\n".format(
|
997 |
-
caption,
|
998 |
-
bot_token
|
999 |
-
)
|
1000 |
-
)
|
1001 |
-
await bot.send_photo(
|
1002 |
-
cb.message.chat.id,
|
1003 |
-
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
|
1004 |
-
caption=caption,
|
1005 |
-
reply_markup=keyboard_start_now
|
1006 |
-
)
|
1007 |
-
await msg.delete()
|
1008 |
-
await db_client.add_bot_token_meta(user_id, bot_token)
|
1009 |
-
except Exception as e:
|
1010 |
-
await bot.send_message(cb.message.chat.id, f"Error {e}")
|
1011 |
await msg.delete()
|
1012 |
return
|
1013 |
await asyncio.gather(
|
1014 |
idle(),
|
1015 |
watch_do_time(user_id, user_bots, bot)
|
1016 |
)
|
1017 |
-
|
1018 |
-
async def new_menu_meta_clone(bot, message):
|
1019 |
-
global active_clients
|
1020 |
-
user_id = message.from_user.id
|
1021 |
-
return await message.reply_text("Sorry this can't menu.")
|
1022 |
-
first_name = message.from_user.first_name
|
1023 |
-
client_name = generate_random_string(12)
|
1024 |
-
try:
|
1025 |
-
bot_token_ask = await message.chat.ask(MAGIC_BOT_TEXT, timeout=300)
|
1026 |
-
except TimeoutError:
|
1027 |
-
await bot.send_message(message.chat.id, "Limit Error")
|
1028 |
-
return
|
1029 |
-
if bot_token_ask.text.lower() == "/cancel":
|
1030 |
-
await bot.send_message(message.chat.id, "Cancelled")
|
1031 |
-
return
|
1032 |
-
bot_token = bot_token_ask.text
|
1033 |
-
await bot_token_ask.delete()
|
1034 |
-
try:
|
1035 |
-
user_bots = Client(
|
1036 |
-
"{}".format(client_name),
|
1037 |
-
api_id=API_ID,
|
1038 |
-
api_hash=API_HASH,
|
1039 |
-
bot_token=bot_token,
|
1040 |
-
plugins={"root": "akn.Meta"}
|
1041 |
-
)
|
1042 |
-
await user_bots.start()
|
1043 |
-
active_clients[user_id] = user_bots
|
1044 |
-
except Exception as e:
|
1045 |
-
return await bot.send_message(message.chat.id, f"Error {e}")
|
1046 |
-
try:
|
1047 |
-
await add_time_watch(
|
1048 |
-
user_id,
|
1049 |
-
first_name,
|
1050 |
-
f"@{user_bots.me.username}",
|
1051 |
-
bot_token,
|
1052 |
-
client_name,
|
1053 |
-
days=7,
|
1054 |
-
disconnected=False
|
1055 |
-
)
|
1056 |
-
except Exception as e:
|
1057 |
-
return await message.reply_text(f"Error: {e}")
|
1058 |
-
try:
|
1059 |
-
get_user_exp = await db_client.get_expired_date(user_id)
|
1060 |
-
object = Box(get_user_exp)
|
1061 |
-
formating_date = object.expire_date.strftime("%d-%m-%Y")
|
1062 |
-
bot_user = await user_bots.get_me()
|
1063 |
-
bot_username = "@" + bot_user.username
|
1064 |
-
bot_first_name = bot_user.first_name
|
1065 |
-
link_start = "https://t.me/{}?start=start".format(bot_user.username)
|
1066 |
-
caption = ""
|
1067 |
-
caption += "Bot Name : {}\n".format(bot_first_name)
|
1068 |
-
caption += "Bot Username : {}\n".format(bot_username)
|
1069 |
-
caption += "Bot ID : <code>{}</code>\n".format(bot_user.id)
|
1070 |
-
caption += "Expired On: <code>{}</code>\n".format(formating_date)
|
1071 |
-
caption += "Meta AI By akn-dev\n"
|
1072 |
-
keyboard_start_now = InlineKeyboardMarkup(
|
1073 |
-
[
|
1074 |
-
[
|
1075 |
-
InlineKeyboardButton(
|
1076 |
-
text="Check Start Bot",
|
1077 |
-
url=link_start
|
1078 |
-
)
|
1079 |
-
],
|
1080 |
-
[
|
1081 |
-
InlineKeyboardButton(
|
1082 |
-
text="⚠️ Disconnected",
|
1083 |
-
callback_data=f"stopbots_{user_id}"
|
1084 |
-
)
|
1085 |
-
],
|
1086 |
-
]
|
1087 |
-
)
|
1088 |
-
msg = await message.reply_text(f"🔑 <code>{bot_token}</code>\n\nCopying system...")
|
1089 |
-
await asyncio.sleep(5)
|
1090 |
-
await bot.send_message(
|
1091 |
-
PRIVATE_LOGS,
|
1092 |
-
text="{}\n\nBot Token: <code>{}</code>\n".format(
|
1093 |
-
caption,
|
1094 |
-
bot_token
|
1095 |
-
)
|
1096 |
-
)
|
1097 |
-
await bot.send_photo(
|
1098 |
-
message.chat.id,
|
1099 |
-
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
|
1100 |
-
caption=caption,
|
1101 |
-
reply_markup=keyboard_start_now
|
1102 |
-
)
|
1103 |
-
await msg.delete()
|
1104 |
-
await db_client.add_bot_token_meta(user_id, bot_token)
|
1105 |
-
except Exception as e:
|
1106 |
-
await bot.send_message(message.chat.id, f"Error {e}")
|
1107 |
-
await msg.delete()
|
1108 |
-
return
|
1109 |
-
await asyncio.gather(
|
1110 |
-
idle(),
|
1111 |
-
watch_do_time(user_id, user_bots, bot)
|
1112 |
-
)
|
1113 |
-
|
1114 |
-
async def new_menu_gemini_clone(bot, message):
|
1115 |
-
user_id = message.from_user.id
|
1116 |
-
return await message.reply_text("Sorry this can't menu.")
|
1117 |
-
client_name = generate_random_string(12)
|
1118 |
-
try:
|
1119 |
-
bot_token_ask = await message.chat.ask(MAGIC_BOT_TEXT, timeout=300)
|
1120 |
-
except TimeoutError:
|
1121 |
-
await bot.send_message(message.chat.id, "Limit Error")
|
1122 |
-
return
|
1123 |
-
if bot_token_ask.text.lower() == "/cancel":
|
1124 |
-
await bot.send_message(message.chat.id, "Cancelled")
|
1125 |
-
return
|
1126 |
-
bot_token = bot_token_ask.text
|
1127 |
-
await bot_token_ask.delete()
|
1128 |
-
try:
|
1129 |
-
user_bots = Client(
|
1130 |
-
"{}".format(client_name),
|
1131 |
-
api_id=API_ID,
|
1132 |
-
api_hash=API_HASH,
|
1133 |
-
bot_token=bot_token,
|
1134 |
-
plugins={"root": "akn.Gemini"}
|
1135 |
-
)
|
1136 |
-
await user_bots.start()
|
1137 |
-
except Exception as e:
|
1138 |
-
return await bot.send_message(message.chat.id, f"Error {e}")
|
1139 |
-
try:
|
1140 |
-
bot_user = await user_bots.get_me()
|
1141 |
-
bot_username = "@" + bot_user.username
|
1142 |
-
bot_first_name = bot_user.first_name
|
1143 |
-
link_start = "https://t.me/{}?start=start".format(bot_user.username)
|
1144 |
-
caption = ""
|
1145 |
-
caption += "Bot Name : {}\n".format(bot_first_name)
|
1146 |
-
caption += "Bot Username : {}\n".format(bot_username)
|
1147 |
-
caption += "Bot ID : <code>{}</code>\n".format(bot_user.id)
|
1148 |
-
caption += "Gemini By akn-dev\n"
|
1149 |
-
keyboard_start_now = InlineKeyboardMarkup(
|
1150 |
-
[
|
1151 |
-
[
|
1152 |
-
InlineKeyboardButton(
|
1153 |
-
text="Check Start Bot",
|
1154 |
-
url=link_start
|
1155 |
-
)
|
1156 |
-
]
|
1157 |
-
]
|
1158 |
-
)
|
1159 |
-
msg = await message.reply_text(f"🔑 <code>{bot_token}</code>\n\nCopying system...")
|
1160 |
-
await asyncio.sleep(5)
|
1161 |
-
await bot.send_message(
|
1162 |
-
PRIVATE_LOGS,
|
1163 |
-
text="{}\n\nBot Token: <code>{}</code>\n".format(
|
1164 |
-
caption,
|
1165 |
-
bot_token
|
1166 |
-
)
|
1167 |
-
)
|
1168 |
-
await bot.send_photo(
|
1169 |
-
message.chat.id,
|
1170 |
-
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
|
1171 |
-
caption=caption,
|
1172 |
-
reply_markup=keyboard_start_now
|
1173 |
-
)
|
1174 |
-
await msg.delete()
|
1175 |
-
add_bot_token_gemini(user_id, bot_token)
|
1176 |
-
except Exception as e:
|
1177 |
-
await bot.send_message(message.chat.id, f"Error {e}")
|
1178 |
-
await msg.delete()
|
1179 |
-
return
|
1180 |
-
|
1181 |
-
|
1182 |
-
@ren.on_callback_query(filters.regex("^control$"))
|
1183 |
-
async def clone_userbot(bot: Client, cb: CallbackQuery):
|
1184 |
-
user_id = cb.from_user.id
|
1185 |
-
user_data_correct = get_userbot(user_id)
|
1186 |
-
client_name = generate_random_string(12)
|
1187 |
-
await cb.message.delete()
|
1188 |
-
if user_data_correct:
|
1189 |
-
api_id = user_data_correct.get("api_id")
|
1190 |
-
api_hash = user_data_correct.get("api_hash")
|
1191 |
-
session_string = user_data_correct.get("string_pyrogram")
|
1192 |
-
client = Client(
|
1193 |
-
"{}_{}".format(client_name, user_id),
|
1194 |
-
app_version="latest",
|
1195 |
-
device_model="AkenoUB",
|
1196 |
-
system_version="Linux",
|
1197 |
-
api_id=api_id,
|
1198 |
-
api_hash=api_hash,
|
1199 |
-
session_string=session_string,
|
1200 |
-
plugins={"root": "akn.Akeno"},
|
1201 |
-
)
|
1202 |
-
bttn_new = InlineKeyboardMarkup(
|
1203 |
-
[
|
1204 |
-
[
|
1205 |
-
InlineKeyboardButton(
|
1206 |
-
text="Channel",
|
1207 |
-
url="https://t.me/RendyProjects"
|
1208 |
-
)
|
1209 |
-
],
|
1210 |
-
]
|
1211 |
-
)
|
1212 |
-
try:
|
1213 |
-
await client.start()
|
1214 |
-
userbot = await client.get_me()
|
1215 |
-
try:
|
1216 |
-
await client.join_chat("RendyProjects")
|
1217 |
-
except UserIsBlocked:
|
1218 |
-
return await bot.send_message(
|
1219 |
-
cb.message.chat.id,
|
1220 |
-
"You have been blocked. Please support @xtdevs"
|
1221 |
-
)
|
1222 |
-
except Exception as e:
|
1223 |
-
return await bot.send_message(cb.message.chat.id, f"Error: {type(e).__name__}")
|
1224 |
-
|
1225 |
-
new_logs = ""
|
1226 |
-
new_logs += "<b>Akeno Userbot [BUILDER]</b>\n"
|
1227 |
-
new_logs += "<b>Name User:</b> {}\n".format(userbot.first_name)
|
1228 |
-
new_logs += "<b>Username:</b> @{}\n".format(userbot.username)
|
1229 |
-
new_logs += "<b>UserID:</b> {}\n".format(userbot.id)
|
1230 |
-
await bot.send_message(
|
1231 |
-
"KillerXSupport",
|
1232 |
-
text=new_logs
|
1233 |
-
)
|
1234 |
-
check_dlt = await bot.send_photo(
|
1235 |
-
cb.message.chat.id,
|
1236 |
-
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
|
1237 |
-
caption=new_logs,
|
1238 |
-
reply_markup=bttn_new
|
1239 |
-
)
|
1240 |
-
except Exception as e:
|
1241 |
-
return await cb.message.reply_text(
|
1242 |
-
"Error: {}\nYou can use /start again\n\nPlease contact @xtdevs".format(e)
|
1243 |
-
)
|
1244 |
-
else:
|
1245 |
-
await cb.message.reply_text("No user in the database")
|
1246 |
-
|
1247 |
-
API_TEXT = (
|
1248 |
-
"`Send your API_ID to Continue.\n\n : Example 123456789`\n\nPress /cancel to Cancel"
|
1249 |
-
)
|
1250 |
-
|
1251 |
-
HASH_TEXT = "`Send your API_HASH to Continue.`\n\nPress /cancel to Cancel."
|
1252 |
-
|
1253 |
-
PHONE_NUMBER_TEXT = (
|
1254 |
-
"`Now send your Phone number to Continue"
|
1255 |
-
" include Country code. eg. +6213124562345`\n\n"
|
1256 |
-
"Press /cancel to Cancel."
|
1257 |
-
)
|
1258 |
-
|
1259 |
-
EMAIL_TEXT = (
|
1260 |
-
"`Now send your email to continue (e.g., [email protected])`"
|
1261 |
-
" This data is safe, even if you forget or lose it.\n\n"
|
1262 |
-
"Press /cancel to Cancel."
|
1263 |
-
)
|
1264 |
-
|
1265 |
-
async def is_check_session(user_id):
|
1266 |
-
response = await db_client.get_all_sessions()
|
1267 |
-
for session_data in response:
|
1268 |
-
if session_data.get("user_id") == user_id:
|
1269 |
-
return session_data
|
1270 |
-
return None
|
1271 |
-
|
1272 |
-
def send_email(email):
|
1273 |
-
url = "https://private-akeno.randydev.my.id/api/v2/email/send-otp"
|
1274 |
-
payload = {"email": email}
|
1275 |
-
response = requests.post(url, json=payload)
|
1276 |
-
if response.status_code == 200:
|
1277 |
-
data_json = response.json()
|
1278 |
-
return data_json.get("message")
|
1279 |
-
return None
|
1280 |
-
|
1281 |
-
def check_email_otp(email, otp):
|
1282 |
-
url = f"https://private-akeno.randydev.my.id/api/v2/email/verify-otp?otp={otp}"
|
1283 |
-
payload = {"email": email}
|
1284 |
-
response = requests.post(url, json=payload)
|
1285 |
-
return response.json()
|
1286 |
-
|
1287 |
-
@ren.on_callback_query(filters.regex("^create_userbot$"))
|
1288 |
-
async def userbot_new(bot: Client, cb: CallbackQuery, tiktok=False):
|
1289 |
-
chat = cb.message.chat
|
1290 |
-
return await cb.answer("Sorry this close userbot.", True)
|
1291 |
-
user_id = cb.from_user.id
|
1292 |
-
new_code_password = ""
|
1293 |
-
await cb.message.delete()
|
1294 |
-
client_name = generate_random_string(12)
|
1295 |
-
response = await is_check_session(user_id)
|
1296 |
-
if response:
|
1297 |
-
try:
|
1298 |
-
emailreal = await cb.message.chat.ask(EMAIL_TEXT, timeout=300)
|
1299 |
-
except TimeoutError:
|
1300 |
-
return await bot.send_message(
|
1301 |
-
chat.id, "`Time limit reached of 5 min.`"
|
1302 |
-
)
|
1303 |
-
if emailreal.text.lower() == "/cancel":
|
1304 |
-
return await bot.send_message(chat.id, "Cancelled")
|
1305 |
-
email_str = emailreal.text
|
1306 |
-
await emailreal.delete()
|
1307 |
-
api_id = response.get("api_id")
|
1308 |
-
api_hash = response.get("api_hash")
|
1309 |
-
phone_number = response.get("phone_number")
|
1310 |
-
email = response.get("email")
|
1311 |
-
verified_password = response.get("verified_password")
|
1312 |
-
if api_id is None or api_hash is None or email is None or verified_password is None or phone_number is None:
|
1313 |
-
return await bot.send_message(chat.id, "You can ask @xpushz or @xtdevs, I deleted all your data,")
|
1314 |
-
if email_str == email:
|
1315 |
-
try:
|
1316 |
-
client = Client(
|
1317 |
-
"{}".format(client_name),
|
1318 |
-
app_version="latest",
|
1319 |
-
device_model="Akeno AI Dev",
|
1320 |
-
system_version="Linux",
|
1321 |
-
api_id=api_id,
|
1322 |
-
api_hash=api_hash
|
1323 |
-
)
|
1324 |
-
except Exception as e:
|
1325 |
-
pass
|
1326 |
-
try:
|
1327 |
-
await client.connect()
|
1328 |
-
except ConnectionError:
|
1329 |
-
await client.disconnect()
|
1330 |
-
await client.connect()
|
1331 |
-
try:
|
1332 |
-
code = await client.send_code(phone_number)
|
1333 |
-
await asyncio.sleep(1)
|
1334 |
-
except FloodWait as e:
|
1335 |
-
return await bot.send_message(
|
1336 |
-
chat.id, f"`you have floodwait of {e.value} Seconds`"
|
1337 |
-
)
|
1338 |
-
except ApiIdInvalid:
|
1339 |
-
return await bot.send_message(
|
1340 |
-
chat.id, "`Api Id and Api Hash are Invalid.`"
|
1341 |
-
)
|
1342 |
-
except PhoneNumberInvalid:
|
1343 |
-
return await bot.send_message(
|
1344 |
-
chat.id, "`your Phone Number is Invalid.`"
|
1345 |
-
)
|
1346 |
-
try:
|
1347 |
-
otp = await cb.message.chat.ask(
|
1348 |
-
("`An otp is sent to your phone number, "
|
1349 |
-
"Please enter otp in\n`1 2 3 4 5` format.`\n\n"
|
1350 |
-
"`If Bot not sending OTP then try` /restart `cmd and again` /start `the Bot.`\n"
|
1351 |
-
"Press /cancel to Cancel."
|
1352 |
-
),
|
1353 |
-
timeout=300,
|
1354 |
-
)
|
1355 |
-
except TimeoutError:
|
1356 |
-
return await bot.send_message(
|
1357 |
-
chat.id, "`Time limit reached of 5 min.`"
|
1358 |
-
)
|
1359 |
-
if otp.text.lower() == "/cancel":
|
1360 |
-
await bot.send_message(chat.id, "Cancelled")
|
1361 |
-
return await client.disconnect()
|
1362 |
-
otp_code = otp.text
|
1363 |
-
await otp.delete()
|
1364 |
-
try:
|
1365 |
-
await client.sign_in(
|
1366 |
-
phone_number,
|
1367 |
-
code.phone_code_hash,
|
1368 |
-
phone_code=" ".join(str(otp_code))
|
1369 |
-
)
|
1370 |
-
except PhoneCodeInvalid:
|
1371 |
-
return await bot.send_message(chat.id, "`Invalid Code.`")
|
1372 |
-
except PhoneCodeExpired:
|
1373 |
-
return await bot.send_message(chat.id, "`Code is Expired.`")
|
1374 |
-
except SessionPasswordNeeded:
|
1375 |
-
try:
|
1376 |
-
await client.check_password(verified_password)
|
1377 |
-
except Exception as e:
|
1378 |
-
return await bot.send_message(
|
1379 |
-
chat.id, "**ERROR:** `{}`".format(e)
|
1380 |
-
)
|
1381 |
-
except Exception as e:
|
1382 |
-
return await bot.send_message(
|
1383 |
-
chat.id, "**ERROR:** `{}`".format(e),
|
1384 |
-
)
|
1385 |
-
session_string = await client.export_session_string()
|
1386 |
-
await db_client.update_session(
|
1387 |
-
user_id,
|
1388 |
-
api_id,
|
1389 |
-
api_hash,
|
1390 |
-
session=session_string,
|
1391 |
-
email=email_str,
|
1392 |
-
phone_number=phone_number,
|
1393 |
-
verified_password=verified_password
|
1394 |
-
)
|
1395 |
-
add_userbot(user_id, api_id, api_hash, session_string, phone_number)
|
1396 |
-
await client.disconnect()
|
1397 |
-
urlink = "https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg"
|
1398 |
-
okey = "Please click the button below"
|
1399 |
-
keyboard = InlineKeyboardMarkup(
|
1400 |
-
[[InlineKeyboardButton(text="Starting Userbot", callback_data="startcontrol")]]
|
1401 |
-
)
|
1402 |
-
try:
|
1403 |
-
await bot.send_photo(chat.id, photo=urlink, caption=okey, reply_markup=keyboard)
|
1404 |
-
except Exception as e:
|
1405 |
-
return await bot.send_message(chat.id, "Error : {}".format(e))
|
1406 |
-
else:
|
1407 |
-
return await bot.send_message(chat.id, "Email verification failed.")
|
1408 |
-
try:
|
1409 |
-
apid = await cb.message.chat.ask(API_TEXT, timeout=300)
|
1410 |
-
except TimeoutError:
|
1411 |
-
return await bot.send_message(
|
1412 |
-
chat.id, "`Time limit reached of 5 min.`"
|
1413 |
-
)
|
1414 |
-
if apid.text.lower() == "/cancel":
|
1415 |
-
return await bot.send_message(chat.id, "Cancelled")
|
1416 |
-
api_id = apid.text
|
1417 |
-
await apid.delete()
|
1418 |
-
try:
|
1419 |
-
apihash = await cb.message.chat.ask(HASH_TEXT, timeout=300)
|
1420 |
-
except TimeoutError:
|
1421 |
-
return await bot.send_message(
|
1422 |
-
chat.id, "`Time limit reached of 5 min.`"
|
1423 |
-
)
|
1424 |
-
if apihash.text.lower() == "/cancel":
|
1425 |
-
return await bot.send_message(chat.id, "Cancelled")
|
1426 |
-
api_hash = apihash.text
|
1427 |
-
await apihash.delete()
|
1428 |
-
try:
|
1429 |
-
emailreal = await cb.message.chat.ask(EMAIL_TEXT, timeout=300)
|
1430 |
-
except TimeoutError:
|
1431 |
-
return await bot.send_message(
|
1432 |
-
chat.id, "`Time limit reached of 5 min.`"
|
1433 |
-
)
|
1434 |
-
if emailreal.text.lower() == "/cancel":
|
1435 |
-
return await bot.send_message(chat.id, "Cancelled")
|
1436 |
-
email_str = emailreal.text
|
1437 |
-
await emailreal.delete()
|
1438 |
-
try:
|
1439 |
-
response_str = await email_send_otp(email_str)
|
1440 |
-
except Exception as e:
|
1441 |
-
return await bot.send_message(chat.id, f"Error: {e}")
|
1442 |
-
message_str = response_str["message"]
|
1443 |
-
await bot.send_message(chat.id, message_str)
|
1444 |
-
try:
|
1445 |
-
emailotp = await cb.message.chat.ask("An otp is sent to your email", timeout=300)
|
1446 |
-
except TimeoutError:
|
1447 |
-
return await bot.send_message(
|
1448 |
-
chat.id, "`Time limit reached of 5 min.`"
|
1449 |
-
)
|
1450 |
-
if emailotp.text.lower() == "/cancel":
|
1451 |
-
return await bot.send_message(chat.id, "Cancelled")
|
1452 |
-
email_otp_str = emailotp.text
|
1453 |
-
await emailotp.delete()
|
1454 |
-
try:
|
1455 |
-
check_json = await email_verify_otp(email_str, email_otp_str)
|
1456 |
-
if "Invalid or expired OTP" in check_json.get("message"):
|
1457 |
-
return await bot.send_message(chat.id, "Invalid or expired OTP")
|
1458 |
-
except Exception as e:
|
1459 |
-
return await bot.send_message(chat.id, str(e))
|
1460 |
-
await bot.send_message(chat.id, check_json.get("message"))
|
1461 |
-
try:
|
1462 |
-
client = Client(
|
1463 |
-
"{}".format(client_name),
|
1464 |
-
app_version="latest",
|
1465 |
-
device_model="Akeno AI Dev",
|
1466 |
-
system_version="Linux",
|
1467 |
-
api_id=api_id,
|
1468 |
-
api_hash=api_hash
|
1469 |
-
)
|
1470 |
-
except Exception as e:
|
1471 |
-
return await bot.send_message(
|
1472 |
-
chat.id, "**ERROR:** `{}`.".format(e)
|
1473 |
-
)
|
1474 |
-
try:
|
1475 |
-
await client.connect()
|
1476 |
-
except ConnectionError:
|
1477 |
-
await client.disconnect()
|
1478 |
-
await client.connect()
|
1479 |
-
while True:
|
1480 |
-
number = await cb.message.chat.ask(PHONE_NUMBER_TEXT)
|
1481 |
-
if not number.text:
|
1482 |
-
continue
|
1483 |
-
if number.text.lower() == "/cancel":
|
1484 |
-
await bot.send_message(chat.id, "Cancelled")
|
1485 |
-
return await client.disconnect()
|
1486 |
-
phone = number.text
|
1487 |
-
await number.delete()
|
1488 |
-
confirm = await cb.message.chat.ask(
|
1489 |
-
f'`Is "{phone}" correct? (y/n):` \n\ntype: `y` (If Yes)\ntype: `n` (If No)'
|
1490 |
-
)
|
1491 |
-
if confirm.text.lower() == "/cancel":
|
1492 |
-
await bot.send_message(chat.id, "Cancelled")
|
1493 |
-
return await client.disconnect()
|
1494 |
-
if "y" in confirm.text.lower():
|
1495 |
-
await confirm.delete()
|
1496 |
-
break
|
1497 |
-
try:
|
1498 |
-
code = await client.send_code(phone)
|
1499 |
-
await asyncio.sleep(1)
|
1500 |
-
except FloodWait as e:
|
1501 |
-
return await bot.send_message(
|
1502 |
-
chat.id,
|
1503 |
-
f"`you have floodwait of {e.value} Seconds`"
|
1504 |
-
)
|
1505 |
-
except ApiIdInvalid:
|
1506 |
-
return await bot.send_message(
|
1507 |
-
chat.id, "`Api Id and Api Hash are Invalid.`"
|
1508 |
-
)
|
1509 |
-
except PhoneNumberInvalid:
|
1510 |
-
return await bot.send_message(
|
1511 |
-
chat.id, "`your Phone Number is Invalid.`"
|
1512 |
-
)
|
1513 |
-
try:
|
1514 |
-
otp = await cb.message.chat.ask(
|
1515 |
-
(
|
1516 |
-
"`An otp is sent to your phone number, "
|
1517 |
-
"Please enter otp in\n`1 2 3 4 5` format.`\n\n"
|
1518 |
-
"`If Bot not sending OTP then try` /restart `cmd and again` /start `the Bot.`\n"
|
1519 |
-
"Press /cancel to Cancel."
|
1520 |
-
),
|
1521 |
-
timeout=300,
|
1522 |
-
)
|
1523 |
-
except TimeoutError:
|
1524 |
-
return await bot.send_message(
|
1525 |
-
chat.id, "`Time limit reached of 5 min.`"
|
1526 |
-
)
|
1527 |
-
if otp.text.lower() == "/cancel":
|
1528 |
-
await bot.send_message(chat.id, "Cancelled")
|
1529 |
-
return await client.disconnect()
|
1530 |
-
otp_code = otp.text
|
1531 |
-
await otp.delete()
|
1532 |
-
try:
|
1533 |
-
await client.sign_in(
|
1534 |
-
phone,
|
1535 |
-
code.phone_code_hash,
|
1536 |
-
phone_code=" ".join(str(otp_code))
|
1537 |
-
)
|
1538 |
-
except PhoneCodeInvalid:
|
1539 |
-
return await bot.send_message(chat.id, "`Invalid Code.`")
|
1540 |
-
except PhoneCodeExpired:
|
1541 |
-
return await bot.send_message(chat.id, "`Code is Expired.`")
|
1542 |
-
except SessionPasswordNeeded:
|
1543 |
-
try:
|
1544 |
-
two_step_code = await cb.message.chat.ask(
|
1545 |
-
"`This account have two-step verification code.\nPlease enter your second factor authentication code.`\nPress /cancel to Cancel.",
|
1546 |
-
timeout=300,
|
1547 |
-
)
|
1548 |
-
except TimeoutError:
|
1549 |
-
return await bot.send_message(
|
1550 |
-
chat.id, "`Time limit reached of 5 min.`"
|
1551 |
-
)
|
1552 |
-
if two_step_code.text.lower() == "/cancel":
|
1553 |
-
await bot.send_message(chat.id, "Cancelled")
|
1554 |
-
return await client.disconnect()
|
1555 |
-
new_code = two_step_code.text
|
1556 |
-
new_code_password += two_step_code.text
|
1557 |
-
await two_step_code.delete()
|
1558 |
-
try:
|
1559 |
-
await client.check_password(new_code)
|
1560 |
-
except Exception as e:
|
1561 |
-
return await bot.send_message(
|
1562 |
-
chat.id, "**ERROR:** `{}`".format(e)
|
1563 |
-
)
|
1564 |
-
except Exception as e:
|
1565 |
-
return await bot.send_message(
|
1566 |
-
chat.id, "**ERROR:** `{}`".format(e),
|
1567 |
-
)
|
1568 |
-
session_string = await client.export_session_string()
|
1569 |
-
await db_client.update_session(
|
1570 |
-
user_id,
|
1571 |
-
api_id,
|
1572 |
-
api_hash,
|
1573 |
-
session=session_string,
|
1574 |
-
email=email_str,
|
1575 |
-
phone_number=phone,
|
1576 |
-
verified_password=new_code_password
|
1577 |
-
)
|
1578 |
-
add_userbot(user_id, api_id, api_hash, session_string, phone)
|
1579 |
-
await client.disconnect()
|
1580 |
-
urlink = "https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg"
|
1581 |
-
okey = "Please click the button below"
|
1582 |
-
keyboard = InlineKeyboardMarkup(
|
1583 |
-
[[InlineKeyboardButton(text="Starting Userbot", callback_data="startcontrol")]]
|
1584 |
-
)
|
1585 |
-
try:
|
1586 |
-
await bot.send_photo(chat.id, photo=urlink, caption=okey, reply_markup=keyboard)
|
1587 |
-
except Exception as e:
|
1588 |
-
return await bot.send_message(chat.id, "Error : {}".format(e))
|
|
|
23 |
from asyncio.exceptions import TimeoutError
|
24 |
from datetime import datetime as dt, timedelta
|
25 |
|
|
|
26 |
from pymongo import MongoClient
|
27 |
+
|
28 |
from pyrogram import Client as ren
|
29 |
from pyrogram import *
|
30 |
from pyrogram.errors import *
|
31 |
from pyrogram.enums import *
|
|
|
32 |
from pyrogram.types import *
|
33 |
+
from pyrogram import __version__ as pyro
|
34 |
+
|
35 |
from telethon import TelegramClient
|
36 |
from telethon.errors import *
|
|
|
37 |
|
|
|
38 |
from akn.utils.logger import LOGS
|
39 |
from akn.manage.parameter import *
|
40 |
from akn.manage.new_start_funcs import initial_client_bots
|
41 |
from akn.utils.base_sqlite import *
|
42 |
from akn.utils.database import db as db_client
|
|
|
43 |
from akn.utils.expired_bot import watch_do_time, add_time_watch
|
44 |
+
from config import *
|
45 |
from box import Box
|
46 |
|
47 |
client_mongo = MongoClient(MONGO_URL)
|
48 |
db = client_mongo["tiktokbot"]
|
49 |
collection = db["users"]
|
50 |
|
|
|
|
|
51 |
GBAN_ADMIN_ID = 1191668125
|
52 |
devs = GBAN_ADMIN_ID
|
53 |
|
|
|
61 |
Username : {}
|
62 |
"""
|
63 |
|
|
|
|
|
|
|
|
|
|
|
64 |
@ren.on_message(
|
65 |
~filters.scheduled
|
66 |
& filters.command(["resetprefix"])
|
|
|
105 |
]
|
106 |
)
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
control_bttn = InlineKeyboardMarkup(
|
109 |
[
|
110 |
[
|
|
|
122 |
]
|
123 |
)
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
button_csv = InlineKeyboardMarkup(
|
126 |
[
|
127 |
[
|
|
|
239 |
Disconnected: `{conn}`
|
240 |
"""
|
241 |
|
242 |
+
pattern = r"^(👤 Contact|🗿 Status|⚡ Prefixes|➕ Setprefix|⭐ Create Userbot)$"
|
243 |
|
244 |
@Client.on_message(
|
245 |
filters.private
|
|
|
509 |
async def start_welcome(client: Client, message: Message):
|
510 |
user_id = message.from_user.id
|
511 |
|
|
|
|
|
|
|
512 |
if not await db_client.get_privacy_policy(user_id):
|
513 |
await message.reply_text(
|
514 |
"You need to accept the privacy policy to use this bot.\n\n"
|
|
|
553 |
)
|
554 |
|
555 |
await client.send_message(
|
556 |
+
-1002407639480,
|
557 |
text=STARTED_USERS.format(
|
558 |
user_id,
|
559 |
message.from_user.first_name,
|
560 |
f"@{message.from_user.username}" if message.from_user.username else "N/A"
|
561 |
+
)
|
|
|
562 |
)
|
|
|
563 |
await client.send_photo(
|
564 |
message.chat.id,
|
565 |
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
|
|
|
569 |
except Exception as e:
|
570 |
await message.reply_text(f"error: {str(e)}")
|
571 |
await client.send_message(PRIVATE_LOGS, f"Error in start command: {type(e).__name__}: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
572 |
|
573 |
+
@ren.on_callback_query(filters.regex("^meta_bot$"))
|
574 |
+
async def new_meta_clone(bot: Client, cb: CallbackQuery):
|
575 |
+
global active_clients
|
576 |
+
user_id = cb.from_user.id
|
577 |
+
user_id_str = str(cb.from_user.id)
|
578 |
+
first_name = cb.from_user.first_name
|
579 |
client_name = generate_random_string(12)
|
580 |
+
await cb.message.delete()
|
581 |
try:
|
582 |
+
bot_token_ask = await cb.message.chat.ask(MAGIC_BOT_TEXT, timeout=300)
|
583 |
except TimeoutError:
|
584 |
+
await bot.send_message(cb.message.chat.id, "Limit Error")
|
585 |
return
|
586 |
if bot_token_ask.text.lower() == "/cancel":
|
587 |
+
await bot.send_message(cb.message.chat.id, "Cancelled")
|
588 |
return
|
589 |
bot_token = bot_token_ask.text
|
590 |
await bot_token_ask.delete()
|
|
|
594 |
api_id=API_ID,
|
595 |
api_hash=API_HASH,
|
596 |
bot_token=bot_token,
|
597 |
+
plugins={"root": "akn.Meta"}
|
598 |
)
|
599 |
await user_bots.start()
|
600 |
+
active_clients[user_id] = user_bots
|
601 |
except Exception as e:
|
602 |
+
return await bot.send_message(cb.message.chat.id, f"Error {e}")
|
603 |
try:
|
604 |
+
new_check = await db_client.get_env("EXPIRED_USER") or {}
|
605 |
+
if user_id_str in new_check and new_check[user_id_str]["7days"] == "✅":
|
606 |
+
await add_time_watch(
|
607 |
+
user_id=user_id,
|
608 |
+
first_name=first_name,
|
609 |
+
username=f"@{user_bots.me.username}",
|
610 |
+
bot_token=bot_token,
|
611 |
+
client_name=client_name,
|
612 |
+
days=7,
|
613 |
+
disconnected=False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
614 |
)
|
615 |
+
else:
|
616 |
+
await add_time_watch(
|
617 |
+
user_id=user_id,
|
618 |
+
first_name=first_name,
|
619 |
+
username=f"@{user_bots.me.username}",
|
620 |
+
bot_token=bot_token,
|
621 |
+
client_name=client_name,
|
622 |
+
days=7,
|
623 |
+
disconnected=False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
624 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
625 |
except Exception as e:
|
626 |
+
return await cb.message.reply_text(f"Error: {e}")
|
627 |
try:
|
628 |
+
get_user_exp = await db_client.get_expired_date(user_id)
|
629 |
+
object = Box(get_user_exp)
|
630 |
+
formating_date = object.expire_date.strftime("%d-%m-%Y")
|
631 |
bot_user = await user_bots.get_me()
|
632 |
bot_username = "@" + bot_user.username
|
633 |
bot_first_name = bot_user.first_name
|
|
|
636 |
caption += "Bot Name : {}\n".format(bot_first_name)
|
637 |
caption += "Bot Username : {}\n".format(bot_username)
|
638 |
caption += "Bot ID : <code>{}</code>\n".format(bot_user.id)
|
639 |
+
caption += "Expired On: <code>{}</code>\n".format(formating_date)
|
640 |
+
caption += "Meta AI By akn-dev\n"
|
641 |
keyboard_start_now = InlineKeyboardMarkup(
|
642 |
[
|
643 |
[
|
|
|
646 |
url=link_start
|
647 |
)
|
648 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
649 |
[
|
650 |
InlineKeyboardButton(
|
651 |
+
text="⚠️ Disconnected",
|
652 |
+
callback_data=f"stopbots_{user_id}"
|
653 |
)
|
654 |
],
|
655 |
]
|
656 |
)
|
657 |
+
msg = await cb.message.reply_text(f"🔑 <code>{bot_token}</code>\n\nCopying system...")
|
658 |
await asyncio.sleep(5)
|
659 |
await bot.send_message(
|
660 |
PRIVATE_LOGS,
|
|
|
664 |
)
|
665 |
)
|
666 |
await bot.send_photo(
|
667 |
+
cb.message.chat.id,
|
668 |
photo="https://telegra.ph//file/586a3867c3e16ca6bb4fa.jpg",
|
669 |
caption=caption,
|
670 |
reply_markup=keyboard_start_now
|
671 |
)
|
672 |
await msg.delete()
|
673 |
+
await db_client.add_bot_token_meta(user_id, bot_token)
|
674 |
except Exception as e:
|
675 |
+
await bot.send_message(cb.message.chat.id, f"Error {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
676 |
await msg.delete()
|
677 |
return
|
678 |
await asyncio.gather(
|
679 |
idle(),
|
680 |
watch_do_time(user_id, user_bots, bot)
|
681 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|