通过我的电报机器人,我必须检查发短信给机器人的用户是否在我的电报频道,我试过:
user_id = event.message.peer_id.user_id #user's id
async for i in bot.iter_participants(mychannelID, filter=ChannelParticipantsRecent):
if user_id != i.id:
status = False
else:
status
我可以得到实体的ID后,获得实体仅通过用户名。是虫子吗?外壳视频
我正在使用Mac和python 3
我试着用身份证来获取实体
entity = client.get_entity(1151511560)
但有个例外:
ValueError: Could not find the input entity for <telethon.tl.types.PeerUser object at 0x1172312e8>. Please read https://telethon.readthedocs.io/en/latest/extra/basic/entities.html to f
当我试图获取用户数据时,我在telethon中遇到了一个错误。首先,我从一些组获得新消息,这很好,但是当我尝试获取用户数据(名称、first_name等)时--有时是可以的,但大多数错误都失败了
ValueError: Could not find the input entity for "12345678".
Please read https://telethon.readthedocs.io/en/latest/extra/basic/entities.html
to find out more details.
我读过那篇文章很多次,试着按它说的那样使用clien
我在python中使用telethon库。我正在尝试使用类型提示来使PyCharm自动完成功能正常工作。在下面的代码片段中,函数filter_open_dialogs以函数的返回值作为输入。阅读telethon文档后,我发现get_dialogs()的返回类型是TotalList,所以向dialogs输入参数添加类型提示。然后我尝试调用函数filter_open_dialogs:
from telethon.tl.types import User
from telethon.helpers import TotalList
from telethon import TelegramClien
好吧,让我们先说我是Python的菜鸟。因此,我正在与Telethon合作,以获得一个电报频道的全部(超过200个)成员列表。 一次又一次的尝试,我发现这段代码完美地达到了我的目标,如果不是它只打印前200个成员的话。 from telethon import TelegramClient, sync
# Use your own values here
api_id = xxx
api_hash = 'xxx'
name = 'xxx'
channel = 'xxx'
client = TelegramClient('Lista_
嗨我真的很绝望..。 我试着用telethon做一个类似与电报机器人对话的测验。它应该看起来像这样: user1 > /start
bot > Hello who send you?
user1 > user0
bot > Thank you. So do you want in channel1 or channel2 or both?
user1 > channel1
*Bot invites the user 我使用了这个示例:https://arabic-telethon.readthedocs.io/en/stable/extra/examples/t
你需要得到有关频道,聊天,小组的信息。由于每个帐户都有接收信息的限制,我将使用几个帐户。我在试着获取信息,但我发现了一个错误:
Traceback (most recent call last):
File "D:/Git/telegram/telegram_new.py", line 50, in parse_entity
channel=entity
TypeError: 'coroutine' object is not callable
During handling of the above exception, another exc
我正试图在一个我是管理员的私人电报频道中获取使用远程电视的用户列表,并将其打印到控制台。我用一个非私有的通道尝试了相同的代码,我也遇到了同样的问题。
我应该使用的用户名引用是什么?我不明白这是否是我的电报用户名,我的频道名称,我的好像我要在频道讲话,或什么。有人能帮忙吗?
from telethon import TelegramClient
from telethon.tl.functions.contacts import ResolveUsernameRequest
from telethon.tl.functions.channels import GetAdminL
我是python的新手。我正在尝试使用telethon shell在聊天中添加和删除用户。我使用取自此处的示例代码https://tl.telethon.dev/methods/messages/add_chat_user.html 我的代码: (我在文本中用任意数字替换的ID和哈希) from telethon.sync import TelegramClient
from telethon import functions, types
from telethon.errors import ChatIdInvalidError
from telethon.errors import P
我正在尝试使用Python3从CSV文件导入联系人。
代码运行良好,没有显示任何错误,但在Telegram中没有添加联系人。你知道为什么吗?
请参见以下代码:
import csv
from telethon import TelegramClient
from telethon.tl.functions.contacts import GetContactsRequest
from telethon.tl.types import InputPeerUser
from telethon.tl.types import InputPhoneContact
api_id = *******
ap