Skip to content

How to: Add New Accounts

Amin Mahmoudi edited this page Sep 29, 2024 · 11 revisions

How to: Add New Accounts

You can add new accounts to your MasterCryptoFarmBot using two methods:

Using Pyrogram Sessions or Using TgWebAppInitData or WebQuery for Modules.


1. πŸ€– Using Pyrogram Sessions

Pyrogram is a Python client for the Telegram API. Pyrogram is like a Telegram client, but it's a library that you can use to interact with Telegram's API. It's a powerful tool that allows you to create bots, automate tasks, and much more.

🟒 Pros:

  • βœ… One-time login for all bot modules.
  • βœ… More access to your account.
  • βœ… Modules can join channels for tasks.
  • βœ… Change names if needed for tasks.
  • βœ… Easier to use.

πŸ”΄ Cons:

  • You need to get Telegram API_ID and API_HASH.
  • There will be a session in your Telegram account.
  • Full access to your account. If you don't trust the bot or you want to install modules from unknown sources, it's better to use the Web Query method.

How to Add New Accounts using Pyrogram Sessions

  1. First of all, you need to get Telegram API_ID and API_HASH, If you don't know how to get them to read this article: HowTo: Get Telegram API_ID & API_HASH, Then you need to open your config.py file and replace default API_ID & API_HASH values with yours.

  2. Navigate to your MasterCryptoFarmBot directory, then run python add_account.py on Windows or python3 add_account.py on Linux.

πŸŸ‘πŸ—’οΈ Note: After adding the account, you need to enable it in the control panel to use it in the modules. Make sure to add a User-Agent to the account in the control panel before enabling it.

Then you will have 2 options:

1. Create a New Session

  1. You will be asked to enter a session name. You can enter a valid (a-zA-Z0-9) session name of your choice or, to keep it simple, just enter your account's Telegram ID. Session names will be stored locally and can be anything as long as they are not duplicated with another session name!
  2. Enter the phone number with the country code, for example: +12345678900 or +989123456789.
  3. At this point, Pyrogram will be called and the rest will be handled by Pyrogram. You will have to enter the received code from Telegram and the 2FA password (if you've enabled 2FA).
  4. Upon successful registration, the application will notify you that the session was created successfully and provide basic info about the session, like user ID, name, username, phone number, and session name.

2. Import Existing Sessions

If you already have Pyrogram .session files, you need to import them again as we store the data locally inside accounts.json. Simply move your session files to the /telegram_accounts directory and select this option. The application will check them for validity and notify you if the import was successful or not.

This is needed to attach some important data like user_agent, proxy, and activation status (should the account be used in modules?) to the session.


2. 🌍 Using TgWebAppInitData

In this wiki, to simplify things I'll use "TgData" instead of "TgWebAppInitData".

This method is used to add accounts to the MasterCryptoFarmBot for a specific module using the TgData of the Telegram Web Application. This method is useful when you don't want to use Pyrogram sessions or you don't have access to the phone number of the account you want to add.

🟑 This method is not recommended for users who want to use several accounts with different modules.

πŸ”΄ You might need to periodically change TgData, as it includes a Time of generation, some apps might invalidate (and give an error) if you are using old TgDataor use it as a Bot Detection factor to ban your accounts before listings.

🟒 Pros:

  • βœ… No need to get API_ID and API_HASH.
  • βœ… No session in your Telegram account.
  • βœ… More secure than Pyrogram sessions for some users.
  • βœ… No need to use a phone number to add the account.

πŸ”΄ Cons:

  • You need to get TgData which could be hard for some users.
  • You need to get TgData for each module you want to add the account to.
  • It's hard to add if you have a lot of accounts and modules.
  • No full control over your account.
  • You can't join channels for tasks.
  • You can't change names if needed for tasks.

How to add accounts using TgData

First, you need to Install A Module, Then go to your MasterCryptoFarm Dashboard, click on Manage Bot Modules, Click on the accounts icon as shown in the screenshot below:

πŸ“Έ Screenshot Module Add Account

Then click on Add module account button, and fill in the following fields:

How to obtain TgData from a Bot

There are several ways to obtain Telegram WebApplication Initial Data, which is used to authorize bots using your Telegram accounts.

1. Using Telegram Desktop

  1. Open Telegram Desktop and head to Settings > Advanced > Experimental Settings > Enable WebView Inspecting.

  2. Open your desired bot's application (Hit Play / Launch Button), then open the developer tools (F12) and go to the Console tab.

  3. Paste the following code in the console and hit enter:

    copy(Telegram.WebApp.initData);
  4. TgData is now copied to your clipboard.

2. Using Android

  1. Open your desired bot's application (Hit Play / Launch Button).
  2. Once it's loaded, turn off your device's Wi-Fi and mobile data, then refresh the page. You can find the refresh button in the top right corner of the screen.
  3. You should see a "Webpage not available" message. Copy the FULL URL that includes #tgWebAppData.

3. Using Web.Telegram.Org

  1. Open Telegram Web and head to your desired bot's application (Hit Play / Launch Button).

  2. Press F12 to open developer tools, then go to the Console tab.

  3. Paste the following code in the console and hit enter:

    copy(document.querySelector("iframe")?.src || "No iframe found.");
  4. TgData is now copied to your clipboard.

InitData Example:

https://major.glados.app/#tgWebAppData%3Dquery_id%3DREDACTED%26user%3D%7B%22id%22%3AREDACTED%2C%22first_name%22%3A%22REDACTED%22%2C%22last_name%22%3A%22%22%2C%22username%22%3A%22REDACTED%22%2C%22language_code%22%3A%22en%22%2C%22is_premium%22%3Atrue%2C%22allows_write_to_pm%22%3Atrue%7D%26auth_date%3DREDACTED%26hash%3DREDACTED%26tgWebAppVersion%3D7.8%26tgWebAppPlatform%3Dweba%26tgWebAppBotInline%3D1%26tgWebAppThemeParams%3D%7B%22bg_color%22%3A%22%23212121%22%2C%22text_color%22%3A%22%23ffffff%22%2C%22hint_color%22%3A%22%23aaaaaa%22%2C%22link_color%22%3A%22%238774e1%22%2C%22button_color%22%3A%22%238774e1%22%2C%22button_text_color%22%3A%22%23ffffff%22%2C%22secondary_bg_color%22%3A%22%230f0f0f%22%2C%22header_bg_color%22%3A%22%23212121%22%2C%22accent_text_color%22%3A%22%238774e1%22%2C%22section_bg_color%22%3A%22%23212121%22%2C%22section_header_text_color%22%3A%22%23aaaaaa%22%2C%22subtitle_text_color%22%3A%22%23aaaaaa%22%2C%22destructive_text_color%22%3A%22%23e53935%22%7D

OR - (both will work)

#tgWebAppData%3Dquery_id%3DREDACTED%26user%3D%7B%22id%22%3AREDACTED%2C%22first_name%22%3A%22REDACTED%22%2C%22last_name%22%3A%22%22%2C%22username%22%3A%22REDACTED%22%2C%22language_code%22%3A%22en%22%2C%22is_premium%22%3Atrue%2C%22allows_write_to_pm%22%3Atrue%7D%26auth_date%3DREDACTED%26hash%3DREDACTED%26tgWebAppVersion%3D7.8%26tgWebAppPlatform%3Dweba%26tgWebAppBotInline%3D1%26tgWebAppThemeParams%3D%7B%22bg_color%22%3A%22%23212121%22%2C%22text_color%22%3A%22%23ffffff%22%2C%22hint_color%22%3A%22%23aaaaaa%22%2C%22link_color%22%3A%22%238774e1%22%2C%22button_color%22%3A%22%238774e1%22%2C%22button_text_color%22%3A%22%23ffffff%22%2C%22secondary_bg_color%22%3A%22%230f0f0f%22%2C%22header_bg_color%22%3A%22%23212121%22%2C%22accent_text_color%22%3A%22%238774e1%22%2C%22section_bg_color%22%3A%22%23212121%22%2C%22section_header_text_color%22%3A%22%23aaaaaa%22%2C%22subtitle_text_color%22%3A%22%23aaaaaa%22%2C%22destructive_text_color%22%3A%22%23e53935%22%7D

So basically, copy the whole URL or just #tgWebAppData to the end.