通过 script/automation 批量创建电报频道

Bulk creation of telegram channels via script/automation

我已经研究了几天,但找不到有关一次或通过自动化创建多个电报频道的方法的指导(Shell 脚本,python,Java等等等等)

目的是通过指定名称、描述和要添加的用户来创建多个频道。

有人可以帮忙吗

普通电报机器人无法创建频道或将用户添加到频道。只有用户机器人可以。 Docs 用于使用 userbot 创建新频道。添加用户(没有他们的 permission/consent)违反 Telegram TOS。

TELEGRAM_USER = <Your telegram username - @my_name>
TELEGRAM_APP_API_ID = <Get the API ID from https://my.telegram.org/apps - App api_id:>
TELEGRAM_APP_API_HASH = <Get the API HASH from https://my.telegram.org/apps - App api_hash:>


def create_channel_with_users(chname, descrip):
    with TelegramClient(TELEGRAM_USER, TELEGRAMA_APP_API_ID, TELEGRAMA_APP_API_HASH) as client:
        result = client(functions.channels.CreateChannelRequest(
            title=chname,
            about=descrip,
            megagroup=True
        ))
        return result