Creating a Telegram Bot without BotFather

Hey everyone! I’m trying to figure out if there’s a way to make Telegram bots without using BotFather. My goal is to have a system where users can make accounts and get their own bots automatically.

I’ve been playing around with a Node.js Telegram library, but I’m stuck on the verification code part. Here’s a bit of my code:

import { TelegramManager } from 'telegram-tools';
import { UserSession } from 'telegram-tools/sessions';
import promptUser from 'user-input';

class BotGenerator {
  constructor(apiKey, apiSecret) {
    this.apiKey = apiKey;
    this.apiSecret = apiSecret;
    this.userSession = new UserSession('');
  }

  async setupBot() {
    const manager = new TelegramManager(this.userSession, this.apiKey, this.apiSecret, {
      maxRetries: 3,
    });

    await manager.initialize({
      phone: '1234567890',
      codeGetter: async () => promptUser('Enter code: '),
      errorHandler: err => console.error(err),
    });

    console.log('Connected successfully!');
    console.log(manager.session.export());
    await manager.sendMsg('self', 'Bot is ready!');
  }
}

Is there a way to skip the code verification or use a different library? I want to create bots for users automatically. Any help would be awesome!

As someone who’s delved deep into Telegram bot development, I can tell you that creating bots without BotFather is a tricky path. While it’s technically possible, it’s not recommended and could potentially violate Telegram’s terms of service.

From my experience, the approach you’re taking with the TelegramManager looks like you’re trying to create user bots, not actual Telegram bots. User bots operate on user accounts, which is why you’re hitting the verification code issue.

Instead, I’d suggest sticking with the official Bot API and BotFather. You can automate the bot creation process by using Telegram’s HTTP Bot API to interact with BotFather programmatically. This way, you can create bots for users without manual intervention, while staying within Telegram’s guidelines.

If you’re set on avoiding BotFather entirely, you might want to look into alternative messaging platforms that offer more flexibility in bot creation. But for Telegram, the official route is your best bet for a stable, long-term solution.

yo, creating bots without botfather is a no-go. it’ll get u in trouble with telegram. i tried somethin similar before and got my account flagged. stick with the official way man. u could try automating the botfather process instead. that way u stay legit and still get what u want. just my 2 cents

I’ve been down this road before, and I can tell you that bypassing BotFather isn’t a viable solution. The code you’ve shared is actually for creating user bots, which is against Telegram’s policies and can get accounts banned.

Instead, consider automating the BotFather process. You can use Telegram’s HTTP API to programmatically interact with BotFather, creating bots for users without manual input. This approach is more reliable and compliant with Telegram’s rules.

If you’re set on avoiding BotFather, you might want to explore other messaging platforms that offer more flexibility in bot creation. However, for Telegram, sticking to the official methods is your safest bet to ensure long-term functionality and avoid potential account issues.