@datareset
развиваюсь.

Как отправить жалобу на телеграмм канал или чат, используя pyrogram?

проблема: любой поисковой запрос сводит на один и тот же нерабочий код
from pyrogram.raw.functions.account import ReportPeer
from pyrogram.raw.types import *

def get_report_reason(text):
    if text == "Report for child abuse.":
        return InputReportReasonChildAbuse()
    elif text == "Report for impersonation.":
        return InputReportReasonFake()
    elif text == "Report for copyrighted content.":
        return InputReportReasonCopyright()
    elif text == "Report an irrelevant geogroup.":
        return InputReportReasonGeoIrrelevant()
    elif text == "Other.":
        return InputReportReasonOther()


peer = app.resolve_peer("@test")
peer_id = peer["channel_id"]
access_hash = peer["access_hash"]

channel = InputPeerChannel(channel_id=peer_id, access_hash=access_hash)
reason  = get_report_reason(report_reason)

report_peer = ReportPeer(
    peer=channel,
    reason=reason,
    message="text"
)
report = app.send(report_peer)

Выдаёт ошибку сначала на взятии peer_id и channel_id из peer ( object is not subscritable )
А потом на то, что метода send вообще не существует.
Вопрос: как жалобу то отправить?
  • Вопрос задан
  • 89 просмотров
Решения вопроса 1
@datareset Автор вопроса
развиваюсь.
Спасибо за отсутствие помощи!
Решил с помощью:
await app.invoke(report_peer)
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы