如何将 Telegram 频道的成员转移到另一个 Telegram 频道

Posted

技术标签:

【中文标题】如何将 Telegram 频道的成员转移到另一个 Telegram 频道【英文标题】:How can I transfer members of a Telegram channel to another Telegram channel 【发布时间】:2018-02-06 19:32:31 【问题描述】:

如何将 Telegram 频道(我是他们的管理员)或群组(或超级群组)的成员转移到另一个 Telegram 频道或群组(我不是他们的管理员)? 问候

【问题讨论】:

【参考方案1】:

您可以非常轻松地使用 Telethon,并且您有很多文档。

针对你的具体问题

from telethon.tl.functions.channels import InviteToChannelRequest

client(InviteToChannelRequest(
channel=SomeChannelId, 
users = ['SomeUserName']
))

【讨论】:

【参考方案2】:

我用过电视马拉松:

from telethon import TelegramClient
from telethon.tl.functions.channels import InviteToChannelRequest
from telethon.tl.functions.channels import GetParticipantsRequest
import asyncio

# Use your own values from my.telegram.org
api_id = 12345
api_hash = 'a1a1a1a1a1a1a11'

channel_to_name = 'migrate_to'
channel_from_name = 'migrate_from'
loop = asyncio.get_event_loop()


client = TelegramClient('anon', api_id, api_hash)
loop.run_until_complete(client.connect())
channel_from = loop.run_until_complete(client.get_entity(channel_from_name))
channel_to = loop.run_until_complete(client.get_entity(channel_to_name))
users = client.iter_participants(channel_from)
users_arr = []
for user in users:
    users_arr.append(user)
loop.run_until_complete(client(InviteToChannelRequest(
        channel_to,
        users_arr
    )))

【讨论】:

以上是关于如何将 Telegram 频道的成员转移到另一个 Telegram 频道的主要内容,如果未能解决你的问题,请参考以下文章