├── Dockerfile
├── LICENSE
├── Procfile
├── README.md
├── TechVJ
├── broadcast.py
├── callbacks.py
├── db.py
├── generate.py
└── start.py
├── app.py
├── config.py
├── main.py
├── requirements.txt
└── runtime.txt
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.10.8-slim
2 | WORKDIR /app
3 | COPY requirements.txt .
4 | RUN pip install --no-cache-dir -r requirements.txt
5 | COPY . .
6 | CMD gunicorn app:app & python3 main.py
7 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 TeamNeiman
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE
22 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | worker: python3 main.py
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## VJ String Session Generator Bot
2 |
3 | ### Features
4 |
5 | - Generate Pyrogram Session
6 | - Generate Pyrogram Bot Session
7 | - Generate Telethon Session
8 | - Generate Telethon Bot Session
9 | - Can Add Force Subscribe Channel
10 | - Can Broadcast Message To Users
11 |
12 | ### Commands
13 |
14 | - `/start` - check bot is alive or not
15 | - `/generate` - generate a string session
16 | - `/broadcast` - broadcast a message to all bot users (owner only)
17 |
18 | ### Variables
19 |
20 | - `API_ID` - Get your Api Id from [my.telegram.org](https://my.telegram.org/apps)
21 | - `API_HASH` - Get your Api Hash from [my.telegram.org](https://my.telegram.org/apps)
22 | - `BOT_TOKEN` - Get your Bot Token from [@BotFather](https://t.me/BotFather)
23 | - `OWNER_ID` - Owner id of owner for broadcasting
24 | - `F_SUB` - Optional, Your Force Subscribe Channel Id & Make Bot Admin Here In This Channel
25 | - `MONGO_DB_URI` - Get mongodb database uri from [MongoDB](https://mongodb.com) Watch [Video Tutorial](https://youtu.be/DAHRmFdw99o)
26 |
27 | ## Credits
28 |
29 | - [Tech VJ](https://youtube.com/@Tech_VJ)
30 |
--------------------------------------------------------------------------------
/TechVJ/broadcast.py:
--------------------------------------------------------------------------------
1 | from pyrogram.errors import InputUserDeactivated, UserNotParticipant, FloodWait, UserIsBlocked, PeerIdInvalid
2 | from TechVJ.db import db
3 | from pyrogram import Client, filters
4 | from config import OWNER_ID
5 | import asyncio
6 | import datetime
7 | import time
8 |
9 | async def broadcast_messages(user_id, message):
10 | try:
11 | await message.copy(chat_id=user_id)
12 | return True, "Success"
13 | except FloodWait as e:
14 | await asyncio.sleep(e.value)
15 | return await broadcast_messages(user_id, message)
16 | except InputUserDeactivated:
17 | await db.delete_user(int(user_id))
18 | return False, "Deleted"
19 | except UserIsBlocked:
20 | await db.delete_user(int(user_id))
21 | return False, "Blocked"
22 | except PeerIdInvalid:
23 | await db.delete_user(int(user_id))
24 | return False, "Error"
25 | except Exception as e:
26 | return False, "Error"
27 |
28 |
29 | @Client.on_message(filters.command("broadcast") & filters.user(OWNER_ID) & filters.reply)
30 | async def verupikkals(bot, message):
31 | users = await db.get_all_users()
32 | b_msg = message.reply_to_message
33 | if not b_msg:
34 | return await message.reply_text("**Reply This Command To Your Broadcast Message**")
35 | sts = await message.reply_text(
36 | text='Broadcasting your messages...'
37 | )
38 | start_time = time.time()
39 | total_users = await db.total_users_count()
40 | done = 0
41 | blocked = 0
42 | deleted = 0
43 | failed =0
44 |
45 | success = 0
46 | async for user in users:
47 | if 'id' in user:
48 | pti, sh = await broadcast_messages(int(user['id']), b_msg)
49 | if pti:
50 | success += 1
51 | elif pti == False:
52 | if sh == "Blocked":
53 | blocked += 1
54 | elif sh == "Deleted":
55 | deleted += 1
56 | elif sh == "Error":
57 | failed += 1
58 | done += 1
59 | if not done % 20:
60 | await sts.edit(f"Broadcast in progress:\n\nTotal Users {total_users}\nCompleted: {done} / {total_users}\nSuccess: {success}\nBlocked: {blocked}\nDeleted: {deleted}")
61 | else:
62 | # Handle the case where 'id' key is missing in the user dictionary
63 | done += 1
64 | failed += 1
65 | if not done % 20:
66 | await sts.edit(f"Broadcast in progress:\n\nTotal Users {total_users}\nCompleted: {done} / {total_users}\nSuccess: {success}\nBlocked: {blocked}\nDeleted: {deleted}")
67 |
68 | time_taken = datetime.timedelta(seconds=int(time.time()-start_time))
69 | await sts.edit(f"Broadcast Completed:\nCompleted in {time_taken} seconds.\n\nTotal Users {total_users}\nCompleted: {done} / {total_users}\nSuccess: {success}\nBlocked: {blocked}\nDeleted: {deleted}")
70 |
--------------------------------------------------------------------------------
/TechVJ/callbacks.py:
--------------------------------------------------------------------------------
1 | import traceback
2 | from pyrogram import Client, filters
3 | from pyrogram.types import CallbackQuery, InlineKeyboardMarkup
4 | from TechVJ.generate import generate_session, ask_ques, buttons_ques
5 |
6 | @Client.on_callback_query(filters.regex(pattern=r"^(generate|pyrogram|pyrogram_bot|telethon_bot|telethon)$"))
7 | async def _callbacks(bot: Client, callback_query: CallbackQuery):
8 | query = callback_query.matches[0].group(1)
9 | if query == "generate":
10 | await callback_query.answer()
11 | await callback_query.message.reply(ask_ques, reply_markup=InlineKeyboardMarkup(buttons_ques))
12 | elif query.startswith("pyrogram") or query.startswith("telethon"):
13 | try:
14 | if query == "pyrogram":
15 | await callback_query.answer()
16 | await generate_session(bot, callback_query.message)
17 | elif query == "pyrogram_bot":
18 | await callback_query.answer("» ᴛʜᴇ sᴇssɪᴏɴ ɢᴇɴᴇʀᴀᴛᴇᴅ ᴡɪʟʟ ʙᴇ ᴏғ ᴩʏʀᴏɢʀᴀᴍ ᴠ2.", show_alert=True)
19 | await generate_session(bot, callback_query.message, is_bot=True)
20 | elif query == "telethon_bot":
21 | await callback_query.answer()
22 | await generate_session(bot, callback_query.message, telethon=True, is_bot=True)
23 | elif query == "telethon":
24 | await callback_query.answer()
25 | await generate_session(bot, callback_query.message, telethon=True)
26 | except Exception as e:
27 | print(traceback.format_exc())
28 | print(e)
29 | await callback_query.message.reply(f"**Error -** {e}")
30 |
--------------------------------------------------------------------------------
/TechVJ/db.py:
--------------------------------------------------------------------------------
1 | import motor.motor_asyncio
2 | from config import MONGO_DB_URI
3 |
4 | class Database:
5 |
6 | def __init__(self, uri, database_name):
7 | self._client = motor.motor_asyncio.AsyncIOMotorClient(uri)
8 | self.db = self._client[database_name]
9 | self.col = self.db.users
10 |
11 | def new_user(self, id, name):
12 | return dict(
13 | id = id,
14 | name = name
15 | )
16 |
17 | async def add_user(self, id, name):
18 | user = self.new_user(id, name)
19 | await self.col.insert_one(user)
20 |
21 | async def is_user_exist(self, id):
22 | user = await self.col.find_one({'id':int(id)})
23 | return bool(user)
24 |
25 | async def total_users_count(self):
26 | count = await self.col.count_documents({})
27 | return count
28 |
29 | async def get_all_users(self):
30 | return self.col.find({})
31 |
32 | async def delete_user(self, user_id):
33 | await self.col.delete_many({'id': int(user_id)})
34 |
35 | db = Database(MONGO_DB_URI, "techvj")
36 |
--------------------------------------------------------------------------------
/TechVJ/generate.py:
--------------------------------------------------------------------------------
1 | import config
2 | from telethon import TelegramClient
3 | from pyrogram import Client, filters
4 | from asyncio.exceptions import TimeoutError
5 | from telethon.sessions import StringSession
6 | from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, Message
7 | from TechVJ.db import db
8 | from pyrogram.errors import (
9 | ApiIdInvalid,
10 | PhoneNumberInvalid,
11 | PhoneCodeInvalid,
12 | PhoneCodeExpired,
13 | SessionPasswordNeeded,
14 | PasswordHashInvalid
15 | )
16 | from telethon.errors import (
17 | ApiIdInvalidError,
18 | PhoneNumberInvalidError,
19 | PhoneCodeInvalidError,
20 | PhoneCodeExpiredError,
21 | SessionPasswordNeededError,
22 | PasswordHashInvalidError
23 | )
24 |
25 | ask_ques = "**» ▷ ᴄʜᴏᴏsᴇ ᴛʜᴇ sᴛʀɪɴɢ ᴡʜɪᴄʜ ʏᴏᴜ ᴡᴀɴᴛ ✔️ : :**"
26 | buttons_ques = [
27 | [
28 | InlineKeyboardButton("𝗧𝗘𝗟𝗘𝗧𝗛𝗢𝗡", callback_data="telethon"),
29 | InlineKeyboardButton("𝗣𝗬𝗥𝗢𝗚𝗥𝗔𝗠", callback_data="pyrogram")
30 | ],[
31 | InlineKeyboardButton("𝗣𝗬𝗥𝗢𝗚𝗥𝗔𝗠 𝗕𝗢𝗧", callback_data="pyrogram_bot"),
32 | InlineKeyboardButton("𝗧𝗘𝗟𝗘𝗧𝗛𝗢𝗡 𝗕𝗢𝗧", callback_data="telethon_bot")
33 | ]
34 | ]
35 |
36 | gen_button = [[InlineKeyboardButton(text="⚡ 𝗚𝗘𝗡𝗘𝗥𝗔𝗧𝗘 𝗦𝗧𝗥𝗜𝗡𝗚 ⚡", callback_data="generate")]]
37 |
38 | @Client.on_message(filters.private & ~filters.forwarded & filters.command(["generate", "gen", "string", "str"]))
39 | async def main(_, msg):
40 | await msg.reply(ask_ques, reply_markup=InlineKeyboardMarkup(buttons_ques))
41 |
42 | async def generate_session(bot: Client, msg: Message, telethon=False, is_bot: bool = False):
43 | if not await db.is_user_exist(msg.from_user.id):
44 | await db.add_user(msg.from_user.id, msg.from_user.first_name)
45 | if config.F_SUB:
46 | try:
47 | await bot.get_chat_member(int(config.F_SUB), msg.from_user.id)
48 | except:
49 | try:
50 | invite_link = await bot.create_chat_invite_link(int(config.F_SUB))
51 | except:
52 | await msg.reply("**Make Sure I Am Admin In Your Channel**")
53 | return
54 | key = InlineKeyboardMarkup(
55 | [[
56 | InlineKeyboardButton("🍿 Join Update Channel 🍿", url=invite_link.invite_link),
57 | InlineKeyboardButton("🍀 Check Again 🍀", callback_data="chk")
58 | ]]
59 | )
60 | await msg.reply_text("**⚠️Access Denied!⚠️\n\nPlease Join My Update Channel To Use Me.If You Joined The Channel Then Click On Check Again Button To Confirm.**", reply_markup=key)
61 | return
62 | if telethon:
63 | ty = "𝗧𝗘𝗟𝗘𝗧𝗛𝗢𝗡"
64 | else:
65 | ty = "𝗣𝗬𝗥𝗢𝗚𝗥𝗔𝗠"
66 | if is_bot:
67 | ty += " 𝗕𝗢𝗧"
68 | await msg.reply(f"» 𝗧𝗥𝗬𝗜𝗡𝗚 𝗧𝗢 𝗦𝗧𝗔𝗥𝗧 **{ty}** 𝗦𝗘𝗦𝗦𝗜𝗢𝗡 𝗚𝗘𝗡𝗘𝗥𝗔𝗧𝗢𝗥...")
69 | user_id = msg.chat.id
70 | api_id_msg = await bot.ask(user_id, "sᴇɴᴅ ʏᴏᴜʀ **𝗔𝗣𝗜_𝗜𝗗** ᴛᴏ ᴘʀᴏᴄᴇᴇᴅ.\n\nᴄʟɪᴄᴋ ᴏɴ /skip ғᴏʀ ᴜsɪɴɢ ʙᴏᴛ ᴀᴘɪ.", filters=filters.text)
71 | if await cancelled(api_id_msg):
72 | return
73 | if api_id_msg.text == "/skip":
74 | api_id = config.API_ID
75 | api_hash = config.API_HASH
76 | else:
77 | try:
78 | api_id = int(api_id_msg.text)
79 | except ValueError:
80 | await api_id_msg.reply("**𝗔𝗣𝗜_𝗜𝗗** ᴍᴜsᴛ ʙᴇ ᴀɴ ɪɴᴛᴇɢᴇʀ, sᴛᴀʀᴛ ɢᴇɴᴇʀᴀᴛɪɴɢ ʏᴏᴜʀ sᴇssɪᴏɴ ᴀɢᴀɪɴ.", quote=True, reply_markup=InlineKeyboardMarkup(gen_button))
81 | return
82 | api_hash_msg = await bot.ask(user_id, "» ɴᴏᴡ sᴇɴᴅ ʏᴏᴜʀ **𝗔𝗣𝗜_𝗛𝗔𝗦𝗛**ᴛᴏ ᴄᴏɴᴛɪɴᴜᴇ.", filters=filters.text)
83 | if await cancelled(api_hash_msg):
84 | return
85 | api_hash = api_hash_msg.text
86 | if not is_bot:
87 | t = "» sᴇɴᴅ ʏᴏᴜʀ **ᴘʜᴏɴᴇ ɴᴜᴍʙᴇʀ** ᴡɪᴛʜ ᴄᴏᴜɴᴛʀʏ ᴄᴏᴅᴇғᴏʀ ᴡʜɪᴄʜ ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ ɢᴇɴᴇʀᴀᴛᴇ sᴇssɪᴏɴ \n𝗘𝗫𝗔𝗠𝗣𝗟𝗘 : `+910000000000`'"
88 | else:
89 | t = "ᴩʟᴇᴀsᴇ sᴇɴᴅ ʏᴏᴜʀ **ʙᴏᴛ_ᴛᴏᴋᴇɴ** ᴛᴏ ᴄᴏɴᴛɪɴᴜᴇ.\nᴇxᴀᴍᴩʟᴇ : `5432198765:abcdanonymousterabaaplol`'"
90 | phone_number_msg = await bot.ask(user_id, t, filters=filters.text)
91 | if await cancelled(phone_number_msg):
92 | return
93 | phone_number = phone_number_msg.text
94 | if not is_bot:
95 | await msg.reply("» ᴛʀʏɪɴɢ ᴛᴏ sᴇɴᴅ ᴏᴛᴩ ᴀᴛ ᴛʜᴇ ɢɪᴠᴇɴ ɴᴜᴍʙᴇʀ...")
96 | else:
97 | await msg.reply("» ᴛʀʏɪɴɢ ᴛᴏ ʟᴏɢɪɴ ᴠɪᴀ ʙᴏᴛ ᴛᴏᴋᴇɴ...")
98 | if telethon and is_bot:
99 | client = TelegramClient(StringSession(), api_id, api_hash)
100 | elif telethon:
101 | client = TelegramClient(StringSession(), api_id, api_hash)
102 | elif is_bot:
103 | client = Client(name="bot", api_id=api_id, api_hash=api_hash, bot_token=phone_number, in_memory=True)
104 | else:
105 | client = Client(name="user", api_id=api_id, api_hash=api_hash, in_memory=True)
106 | await client.connect()
107 | try:
108 | code = None
109 | if not is_bot:
110 | if telethon:
111 | code = await client.send_code_request(phone_number)
112 | else:
113 | code = await client.send_code(phone_number)
114 | except (ApiIdInvalid, ApiIdInvalidError):
115 | await msg.reply("» ʏᴏᴜʀ **ᴀᴩɪ_ɪᴅ** ᴀɴᴅ **ᴀᴩɪ_ʜᴀsʜ** ᴄᴏᴍʙɪɴᴀᴛɪᴏɴ ᴅᴏᴇsɴ'ᴛ ᴍᴀᴛᴄʜ ᴡɪᴛʜ ᴛᴇʟᴇɢʀᴀᴍ ᴀᴩᴩs sʏsᴛᴇᴍ. \n\nᴩʟᴇᴀsᴇ sᴛᴀʀᴛ ɢᴇɴᴇʀᴀᴛɪɴɢ ʏᴏᴜʀ sᴇssɪᴏɴ ᴀɢᴀɪɴ.", reply_markup=InlineKeyboardMarkup(gen_button))
116 | return
117 | except (PhoneNumberInvalid, PhoneNumberInvalidError):
118 | await msg.reply("» ᴛʜᴇ **ᴩʜᴏɴᴇ_ɴᴜᴍʙᴇʀ** ʏᴏᴜ'ᴠᴇ sᴇɴᴛ ᴅᴏᴇsɴ'ᴛ ʙᴇʟᴏɴɢ ᴛᴏ ᴀɴʏ ᴛᴇʟᴇɢʀᴀᴍ ᴀᴄᴄᴏᴜɴᴛ.\n\nᴩʟᴇᴀsᴇ sᴛᴀʀᴛ ɢᴇɴᴇʀᴀᴛɪɴɢ ʏᴏᴜʀ sᴇssɪᴏɴ ᴀɢᴀɪɴ.", reply_markup=InlineKeyboardMarkup(gen_button))
119 | return
120 | try:
121 | phone_code_msg = None
122 | if not is_bot:
123 | phone_code_msg = await bot.ask(user_id, "» ᴩʟᴇᴀsᴇ sᴇɴᴅ ᴛʜᴇ **ᴏᴛᴩ** ᴛʜᴀᴛ ʏᴏᴜ'ᴠᴇ ʀᴇᴄᴇɪᴠᴇᴅ ғʀᴏᴍ ᴛᴇʟᴇɢʀᴀᴍ ᴏɴ ʏᴏᴜʀ ᴀᴄᴄᴏᴜɴᴛ.\nɪғ ᴏᴛᴩ ɪs `12345`, **ᴩʟᴇᴀsᴇ sᴇɴᴅ ɪᴛ ᴀs** `1 2 3 4 5`.", filters=filters.text, timeout=600)
124 | if await cancelled(phone_code_msg):
125 | return
126 | except TimeoutError:
127 | await msg.reply("» ᴛɪᴍᴇ ʟɪᴍɪᴛ ʀᴇᴀᴄʜᴇᴅ ᴏғ 10 ᴍɪɴᴜᴛᴇs.\n\nᴩʟᴇᴀsᴇ sᴛᴀʀᴛ ɢᴇɴᴇʀᴀᴛɪɴɢ ʏᴏᴜʀ sᴇssɪᴏɴ ᴀɢᴀɪɴ.", reply_markup=InlineKeyboardMarkup(gen_button))
128 | return
129 | if not is_bot:
130 | phone_code = phone_code_msg.text.replace(" ", "")
131 | try:
132 | if telethon:
133 | await client.sign_in(phone_number, phone_code, password=None)
134 | else:
135 | await client.sign_in(phone_number, code.phone_code_hash, phone_code)
136 | except (PhoneCodeInvalid, PhoneCodeInvalidError):
137 | await msg.reply("» ᴛʜᴇ ᴏᴛᴩ ʏᴏᴜ'ᴠᴇ sᴇɴᴛ ɪs **ᴡʀᴏɴɢ.**\n\nᴩʟᴇᴀsᴇ sᴛᴀʀᴛ ɢᴇɴᴇʀᴀᴛɪɴɢ ʏᴏᴜʀ sᴇssɪᴏɴ ᴀɢᴀɪɴ.", reply_markup=InlineKeyboardMarkup(gen_button))
138 | return
139 | except (PhoneCodeExpired, PhoneCodeExpiredError):
140 | await msg.reply("» ᴛʜᴇ ᴏᴛᴩ ʏᴏᴜ'ᴠᴇ sᴇɴᴛ ɪs **ᴇxᴩɪʀᴇᴅ.**\n\nᴩʟᴇᴀsᴇ sᴛᴀʀᴛ ɢᴇɴᴇʀᴀᴛɪɴɢ ʏᴏᴜʀ sᴇssɪᴏɴ ᴀɢᴀɪɴ.", reply_markup=InlineKeyboardMarkup(gen_button))
141 | return
142 | except (SessionPasswordNeeded, SessionPasswordNeededError):
143 | try:
144 | two_step_msg = await bot.ask(user_id, "» ᴩʟᴇᴀsᴇ ᴇɴᴛᴇʀ ʏᴏᴜʀ **ᴛᴡᴏ sᴛᴇᴩ ᴠᴇʀɪғɪᴄᴀᴛɪᴏɴ** ᴩᴀssᴡᴏʀᴅ ᴛᴏ ᴄᴏɴᴛɪɴᴜᴇ.", filters=filters.text, timeout=300)
145 | except TimeoutError:
146 | await msg.reply("» ᴛɪᴍᴇ ʟɪᴍɪᴛ ʀᴇᴀᴄʜᴇᴅ ᴏғ 5 ᴍɪɴᴜᴛᴇs.\n\nᴩʟᴇᴀsᴇ sᴛᴀʀᴛ ɢᴇɴᴇʀᴀᴛɪɴɢ ʏᴏᴜʀ sᴇssɪᴏɴ ᴀɢᴀɪɴ.", reply_markup=InlineKeyboardMarkup(gen_button))
147 | return
148 | try:
149 | password = two_step_msg.text
150 | if telethon:
151 | await client.sign_in(password=password)
152 | else:
153 | await client.check_password(password=password)
154 | if await cancelled(api_id_msg):
155 | return
156 | except (PasswordHashInvalid, PasswordHashInvalidError):
157 | await two_step_msg.reply("» ᴛʜᴇ ᴩᴀssᴡᴏʀᴅ ʏᴏᴜ'ᴠᴇ sᴇɴᴛ ɪs ᴡʀᴏɴɢ.\n\nᴩʟᴇᴀsᴇ sᴛᴀʀᴛ ɢᴇɴᴇʀᴀᴛɪɴɢ ʏᴏᴜʀ sᴇssɪᴏɴ ᴀɢᴀɪɴ.", quote=True, reply_markup=InlineKeyboardMarkup(gen_button))
158 | return
159 | else:
160 | if telethon:
161 | await client.start(bot_token=phone_number)
162 | else:
163 | await client.sign_in_bot(phone_number)
164 | if telethon:
165 | string_session = client.session.save()
166 | else:
167 | string_session = await client.export_session_string()
168 | text = f"**𝐓𝐡𝐢𝐬 𝐈𝐬 𝐘𝐨𝐮𝐫 {ty} 𝐒𝐭𝐫𝐢𝐧𝐠 𝐒𝐞𝐬𝐬𝐢𝐨𝐧** \n\n`{string_session}` \n\n**𝐆𝐞𝐧𝐞𝐫𝐚𝐭𝐞𝐝 𝐁𝐲 :- @VJ_Botz\n⚡ **𝐍𝐎𝐓𝐄 :** 𝐃𝐨𝐧𝐭 𝐒𝐡𝐚𝐫𝐞 𝐖𝐢𝐭𝐡 𝐀𝐧𝐲𝐨𝐧𝐞 𝐁𝐞𝐜𝐚𝐮𝐬𝐞 𝐇𝐞 𝐂𝐚𝐧 𝐇𝐚𝐜𝐤 𝐘𝐨𝐮𝐫 𝐀𝐥𝐥 𝐃𝐚𝐭𝐚. 🙂 𝐀𝐧𝐝 𝐃𝐨𝐧𝐭 𝐅𝐨𝐫𝐠𝐞𝐭 𝐓𝐨 𝐉𝐨𝐢𝐧 @VJ_Botz & @VJ_Bot_Disscussion 🥺"
169 | try:
170 | if not is_bot:
171 | await client.send_message("me", text)
172 | else:
173 | await bot.send_message(msg.chat.id, text)
174 | except KeyError:
175 | pass
176 | await client.disconnect()
177 | await bot.send_message(msg.chat.id, "» 𝐒𝐮𝐜𝐜𝐞𝐬𝐬𝐟𝐮𝐥𝐥𝐲 𝐆𝐫𝐧𝐞𝐫𝐚𝐭𝐞𝐝 𝐘𝐨𝐮 {} 𝐒𝐭𝐫𝐢𝐧𝐠 𝐒𝐞𝐬𝐬𝐢𝐨𝐧.\n\n𝐏𝐥𝐞𝐚𝐬𝐞 𝐂𝐡𝐞𝐜𝐤 𝐘𝐨𝐮𝐫 𝐒𝐚𝐯𝐞𝐝 𝐌𝐞𝐬𝐬𝐚𝐠𝐞 𝐓𝐨 𝐆𝐞𝐭 𝐈𝐭 ! \n\n𝐀 𝐒𝐭𝐫𝐢𝐧𝐠 𝐆𝐞𝐧𝐞𝐫𝐚𝐭𝐨𝐫 𝐁𝐨𝐭 𝐁𝐲 @VJ_Bot_Disscussion ♦".format("ᴛᴇʟᴇᴛʜᴏɴ" if telethon else "ᴩʏʀᴏɢʀᴀᴍ"))
178 |
179 |
180 | async def cancelled(msg):
181 | if "/cancel" in msg.text:
182 | await msg.reply("**» ᴄᴀɴᴄᴇʟʟᴇᴅ ᴛʜᴇ ᴏɴɢᴏɪɴɢ sᴛʀɪɴɢ ɢᴇɴᴇʀᴀᴛɪᴏɴ ᴩʀᴏᴄᴇss !**", quote=True, reply_markup=InlineKeyboardMarkup(gen_button))
183 | return True
184 | elif "/restart" in msg.text:
185 | await msg.reply("**» sᴜᴄᴄᴇssғᴜʟʟʏ ʀᴇsᴛᴀʀᴛᴇᴅ ᴛʜɪs ʙᴏᴛ ғᴏʀ ʏᴏᴜ !**", quote=True, reply_markup=InlineKeyboardMarkup(gen_button))
186 | return True
187 | elif "/skip" in msg.text:
188 | return False
189 | elif msg.text.startswith("/"): # Bot Commands
190 | await msg.reply("**» 𝐂𝐀𝐍𝐂𝐄𝐋𝐋𝐄𝐃 𝐓𝐇𝐄 𝐎𝐍𝐆𝐎𝐈𝐍𝐆 𝐒𝐓𝐑𝐈𝐍𝐆 𝐒𝐄𝐒𝐒𝐈𝐎𝐍 𝐆𝐄𝐍𝐄𝐑𝐀𝐓𝐈𝐍𝐆 𝐏𝐑𝐎𝐂𝐄𝐒𝐒 !**", quote=True)
191 | return True
192 | else:
193 | return False
194 |
--------------------------------------------------------------------------------
/TechVJ/start.py:
--------------------------------------------------------------------------------
1 | from pyrogram import Client, filters
2 | from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, Message, CallbackQuery
3 | from config import OWNER_ID, F_SUB
4 | from TechVJ.db import db
5 |
6 | @Client.on_message(filters.private & filters.incoming & filters.command("start"))
7 | async def start(bot: Client, msg: Message):
8 | if not await db.is_user_exist(msg.from_user.id):
9 | await db.add_user(msg.from_user.id, msg.from_user.first_name)
10 | if F_SUB:
11 | try:
12 | await bot.get_chat_member(int(F_SUB), msg.from_user.id)
13 | except:
14 | try:
15 | invite_link = await bot.create_chat_invite_link(int(F_SUB))
16 | except:
17 | await msg.reply("**Make Sure I Am Admin In Your Channel**")
18 | return
19 | key = InlineKeyboardMarkup(
20 | [[
21 | InlineKeyboardButton("🍿 Join Update Channel 🍿", url=invite_link.invite_link),
22 | InlineKeyboardButton("🍀 Check Again 🍀", callback_data="chk")
23 | ]]
24 | )
25 | await msg.reply_text("**⚠️Access Denied!⚠️\n\nPlease Join My Update Channel To Use Me.If You Joined The Channel Then Click On Check Again Button To Confirm.**", reply_markup=key)
26 | return
27 | me = (await bot.get_me()).mention
28 | await bot.send_message(
29 | chat_id=msg.chat.id,
30 | text=f"""𝐇𝐞𝐲 {msg.from_user.mention}🍷,\n\nɪ ᴀᴍ {me},\nᴛʀᴜsᴛᴇᴅ 𝗦𝗧𝗥𝗜𝗡𝗚 𝗚𝗥𝗡𝗘𝗥𝗔𝗧𝗢𝗥 ʙᴏᴛ.ғᴜʟʟʏ sᴀғᴇ & sᴇᴄᴜʀᴇ.\nɴᴏ ᴀɴʏ ᴇʀʀᴏʀ\n\nMade With By : [VJ Botz](https://t.me/VJ_Botz) !""",
31 | reply_markup=InlineKeyboardMarkup(
32 | [[
33 | InlineKeyboardButton(text="⚡ Generate String Session ⚡", callback_data="generate")
34 | ],[
35 | InlineKeyboardButton("❣️ Support Group ❣️", url="https://t.me/VJ_Bot_Disscussion"),
36 | InlineKeyboardButton("🥀 Update Channel 🥀", url="https://t.me/VJ_Botz")
37 | ]]
38 | )
39 | )
40 |
41 | @Client.on_callback_query(filters.regex("chk"))
42 | async def chk(bot : Client, cb : CallbackQuery):
43 | try:
44 | await bot.get_chat_member(int(F_SUB), cb.from_user.id)
45 | except:
46 | await cb.answer("🙅♂️ You are not joined my channel first join channel then check again. 🙅♂️", show_alert=True)
47 | return
48 | me = (await bot.get_me()).mention
49 | await bot.send_message(
50 | chat_id=cb.from_user.id,
51 | text=f"""𝐇𝐞𝐲 {cb.from_user.mention}🍷,\n\nɪ ᴀᴍ {me},\nᴛʀᴜsᴛᴇᴅ 𝗦𝗧𝗥𝗜𝗡𝗚 𝗚𝗥𝗡𝗘𝗥𝗔𝗧𝗢𝗥 ʙᴏᴛ.ғᴜʟʟʏ sᴀғᴇ & sᴇᴄᴜʀᴇ.\nɴᴏ ᴀɴʏ ᴇʀʀᴏʀ\n\nMade With By : [VJ Botz](https://t.me/VJ_Botz) !""",
52 | reply_markup=InlineKeyboardMarkup(
53 | [[
54 | InlineKeyboardButton(text="⚡ Generate String Session ⚡", callback_data="generate")
55 | ],[
56 | InlineKeyboardButton("❣️ Support Group ❣️", url="https://t.me/VJ_Bot_Disscussion"),
57 | InlineKeyboardButton("🥀 Update Channel 🥀", url="https://t.me/VJ_Botz")
58 | ]]
59 | )
60 | )
61 |
--------------------------------------------------------------------------------
/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask
2 | app = Flask(__name__)
3 |
4 | @app.route('/')
5 | def hello_world():
6 | return 'TechVJ'
7 |
8 | if __name__ == "__main__":
9 | app.run()
10 |
--------------------------------------------------------------------------------
/config.py:
--------------------------------------------------------------------------------
1 | from os import environ
2 |
3 | # Telegram Account Api Id And Api Hash
4 | API_ID = int(environ.get("API_ID", ""))
5 | API_HASH = environ.get("API_HASH", "")
6 |
7 | # Your Main Bot Token
8 | BOT_TOKEN = environ.get("BOT_TOKEN", "")
9 |
10 | # Owner ID For Broadcasting
11 | OWNER_ID = int(environ.get("OWNER_ID", "")) # Owner Id or Admin Id
12 |
13 | # Give Your Force Subscribe Channel Id Below And Make Bot Admin With Full Right.
14 | F_SUB = environ.get("F_SUB", "")
15 |
16 | # Mongodb Database Uri For User Data Store
17 | MONGO_DB_URI = environ.get("MONGO_DB_URI", "")
18 |
19 | # Port To Run Web Application
20 | PORT = int(environ.get('PORT', 8080))
21 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | from pyrogram import Client
2 | from config import API_ID, API_HASH, BOT_TOKEN
3 |
4 | class Bot(Client):
5 | def __init__(self):
6 | super().__init__(
7 | "vj string session bot",
8 | api_id=API_ID,
9 | api_hash=API_HASH,
10 | bot_token=BOT_TOKEN,
11 | plugins=dict(root="TechVJ"),
12 | workers=150,
13 | sleep_threshold=10
14 | )
15 |
16 | async def start(self):
17 | await super().start()
18 | me = await self.get_me()
19 | self.username = '@' + me.username
20 | print('Bot Started Powered By @VJ_Botz')
21 |
22 | async def stop(self, *args):
23 | await super().stop()
24 | print('Bot Stopped Bye')
25 |
26 | Bot().run()
27 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | dnspython
2 | motor
3 | psutil
4 | pyrofork==2.3.45
5 | python-dotenv
6 | telethon
7 | TgCrypto
8 | Flask==1.1.2
9 | gunicorn==20.1.0
10 | Jinja2==3.0.3
11 | werkzeug==2.0.2
12 | itsdangerous==2.0.1
13 |
--------------------------------------------------------------------------------
/runtime.txt:
--------------------------------------------------------------------------------
1 | python-3.10.8
2 |
--------------------------------------------------------------------------------