当用户询问时自动将用户添加到频道 [英] Add user to channel automatically when user asks

查看:44
本文介绍了当用户询问时自动将用户添加到频道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做一个非常简单的项目:

I want to make a very simple project that does this:

一个用户(我们称他为 John)与我的机器人打开 Telegram 聊天,然后输入:

An user (let's call him John) opens a Telegram chat with my bot, and inputs this:

用户约翰:/join channel1

User John: /join channel1

我的机器人响应将用户John"添加到频道channel1"

这就是我想要的.问题是 Telegram BOT API 没有实现任何将用户添加到组的方法.我尝试使用 telegram-cli 但chat_add_user"似乎只接受将用户添加到聊天中,而不接受添加到群组中.

That's actually all I want. The problem is that Telegram BOT API does not implement any method to add users to groups. I tried to use telegram-cli but 'chat_add_user' only seems to accept adding user to chats, not to groups.

有什么办法可以将用户添加到这样的频道吗?(无需手动操作)还是我应该忘记这一点?

Is there any way I can add an user to a channel like that? (Without manually doing it) or should I forget about this?

谢谢!

推荐答案

您可以通过以下方式邀请其他用户加入您的频道:

You can invite other users to your channel using:

channels.inviteToChannel#199f3a6c channel:InputChannel users:Vector<InputUser> = Updates;

您可以通过 InputUser 的列表(向量)一次邀请多个用户.

You can invite several uses at a time, via a list (Vector) of InputUser.

这似乎与 Telegram Desktop 和移动客户端一致,后者允许您选择多个联系人并将其添加到您的群组中.

This seems consistent with Telegram Desktop and the mobile clients, which allows you to select multiple contacts and add them to your group.

InputUser 的形式为:

inputUser#d8292816 user_id:int access_hash:long = InputUser;

这篇关于当用户询问时自动将用户添加到频道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆