- Apr 23, 2024
- 2,105
- 4,226
Hey BHW!
As promised i want to share with you guys my source code of my Telegram Mass DM Bot.
First, our requirements to make it run. What we need Joshua? Simple boys. I made a easy to follow guide for you . There is no coding knowledge required but you will learn for sure how to use Python.
So, let's begin.
1 - Getting started and installing all the required programs.
Visual Studio Code for your OS (Windows, macOS, Linux )
Download and Install from https://code.visualstudio.com/download
2- Download and Install Python
https://www.python.org/downloads/
3- Open VSCode, create a new file you can name it main.py
4 - Open the file above created and copy + paste this code
As simple as that but there are points that must be filled, we are not ready to run yet...Just follow me below.
5 - Adding the text file where the target usernames are
Create a new file for the usernames to send messages, i call it usernames.txt in the code so you can use the same name .
If you use another file name , you must modify the above code then but i've tagged the whole code so is more easier to read.
Go to https://my.telegram.org ( You must login )
Create an app
Fill in the app details
Extract the api ID
Extract the api hash
Input the api id in the main.py
Input the api hash in the main.py
Input the account number in the main.py
7- Open the Python Terminal through VSCode
8 - Installing required libraries, only telethon. I tried to make the code easier to install so with telethon everything is covered.
First type
9 - With all the steps above filled now you are ready to run the code just typing
TAKE IN MIND BEFORE RUNNING
All the code is quite optimized and updated but for BULK tasks i would recommend to use bulk accounts. Do not use your own account to send 100's of DMs because I can't guarantee you won't get your accounts flagged or banned.
IF you need any help kindly post here and i'll assist you.
PS : This is not a sales thread and this tool is shared for FREE neither I'm not distributing this to catch customers as i'm my tools are not available to buy anymore.
With this said, enjoy.
J.J
As promised i want to share with you guys my source code of my Telegram Mass DM Bot.
First, our requirements to make it run. What we need Joshua? Simple boys. I made a easy to follow guide for you . There is no coding knowledge required but you will learn for sure how to use Python.
So, let's begin.
1 - Getting started and installing all the required programs.
Visual Studio Code for your OS (Windows, macOS, Linux )
Download and Install from https://code.visualstudio.com/download
2- Download and Install Python
https://www.python.org/downloads/
3- Open VSCode, create a new file you can name it main.py
4 - Open the file above created and copy + paste this code
Python:
# Start copying the code since this line if you don't understand Python
from telethon.sync import TelegramClient
# Function to login to Telegram
def login(api_id, api_hash, phone_number):
client = TelegramClient('session_name', api_id, api_hash)
client.connect()
if not client.is_user_authorized():
client.send_code_request(phone_number)
client.sign_in(phone_number, input('Enter the code: '))
return client
# Function to send message to list of usernames
def send_message(client, username_file, message):
with open(username_file, 'r') as file:
usernames = file.readlines()
for username in usernames:
try:
client.send_message(username.strip(), message)
print(f"Message sent to {username.strip()} successfully!")
except Exception as e:
print(f"Failed to send message to {username.strip()}: {e}")
# Main function
def main():
# Input your Telegram API credentials
api_id = 'xxxxxxxxxx'
api_hash = 'xxxxxxxxxxxxx'
phone_number = 'xxxxxxxxxx'
# Login to Telegram
client = login(api_id, api_hash, phone_number)
# Send message
username_file = 'usernames.txt' # Name of the text file containing usernames
message = 'MY NAME IS JOSHUA AND THIS IS MY MASS DM BOT WORKING. Congrats you make it!' # Message to be sent
send_message(client, username_file, message)
if __name__ == '__main__':
main()
As simple as that but there are points that must be filled, we are not ready to run yet...Just follow me below.
5 - Adding the text file where the target usernames are
Create a new file for the usernames to send messages, i call it usernames.txt in the code so you can use the same name .
If you use another file name , you must modify the above code then but i've tagged the whole code so is more easier to read.
6 - Extracting API ID, HASH ID for accounts and setting up the python file.In this file you must put the usernames -one per line- with the @ added , example :
@bhw
@username1
@username2
@username3
Go to https://my.telegram.org ( You must login )
Create an app
Fill in the app details
Extract the api ID
Extract the api hash
Input the api id in the main.py
Input the api hash in the main.py
Input the account number in the main.py
7- Open the Python Terminal through VSCode
8 - Installing required libraries, only telethon. I tried to make the code easier to install so with telethon everything is covered.
First type
pip3 = pip / May change depend on your OSpip3 install telethon
9 - With all the steps above filled now you are ready to run the code just typing
Python3 = python / May change depend on your OSpython3 main.py
TAKE IN MIND BEFORE RUNNING
All the code is quite optimized and updated but for BULK tasks i would recommend to use bulk accounts. Do not use your own account to send 100's of DMs because I can't guarantee you won't get your accounts flagged or banned.
IF you need any help kindly post here and i'll assist you.
PS : This is not a sales thread and this tool is shared for FREE neither I'm not distributing this to catch customers as i'm my tools are not available to buy anymore.
With this said, enjoy.
J.J