我如何将 Telegram 频道(我是他们的管理员)或群组(或超级群组)的成员转移到另一个 Telegram 频道或群组(我不是他们的管理员)? 问候
你可以很容易地使用 telethon,而且你有很多文档。
针对您的具体问题
from telethon.tl.functions.channels import InviteToChannelRequest
client(InviteToChannelRequest(
channel=SomeChannelId,
users = ['SomeUserName']
))
我用过telethon:
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
)))