如何使用用户帐户阻止实体?
How can I block an entity with user account?
我想用用户帐户阻止实体,例如用户或机器人。我找不到任何方法。此外,最好存在一些解除阻止实体的方法。
您需要使用所谓的 raw API. Searching for "block" takes us to BlockRequest
,它带有一个示例:
from telethon.sync import TelegramClient
from telethon import functions, types
with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.contacts.BlockRequest(
id='username'
))
print(result)
我想用用户帐户阻止实体,例如用户或机器人。我找不到任何方法。此外,最好存在一些解除阻止实体的方法。
您需要使用所谓的 raw API. Searching for "block" takes us to BlockRequest
,它带有一个示例:
from telethon.sync import TelegramClient
from telethon import functions, types
with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.contacts.BlockRequest(
id='username'
))
print(result)