简体   繁体   English

Telethon InviteToChannelRequest

[英]Telethon InviteToChannelRequest

Hello I tried to add users to my Channel with telethon InviteToChannelRequest.您好,我尝试使用 Telethon InviteToChannelRequest 将用户添加到我的频道。 My code:我的代码:

    channel = InputPeerChannel(id, hash)
    user = InputPeerUser(id, hash)
    client(InviteToChannelRequest(channel=channel, users=[user]))

I don't get an error but it doesn't work.我没有收到错误,但它不起作用。 I tried with nearly all possible types of channel and users, but nothing seems to work.我尝试了几乎所有可能类型的频道和用户,但似乎没有任何效果。 Any idea of what I am doing wrong?知道我做错了什么吗?

You could use AddChatUserRequest method :您可以使用AddChatUserRequest 方法

client(AddChatUserRequest(
    chat_id=123456789,
    user_id=example,
    fwd_limit=10
))

Note: you need to be an channel admin注意:您需要是频道管理员

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM