Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reporting spam or abuse via Telethon

I'm using Telethon in python to automatic replies in Telegram's Group. I wanna reporting spam or abuse an account automatically via the Telethon and I read the Telethon document and google it, but I can't find any example. If this can be done, please provide an example with a sample code.

like image 740
Ali Hesari Avatar asked Jan 30 '26 06:01

Ali Hesari


2 Answers

One can use search to find the following report methods:

  • messages.ReportRequest to report one or more messages.
  • account.ReportPeerRequest to report a user in private, chat or channel with a specific reason.
  • messages.ReportSpamRequest to report a user in private, chat or channel without a reason.
  • channels.ReportSpamRequest to report one or more messages of a user in a channel.
like image 145
Lonami Avatar answered Feb 01 '26 20:02

Lonami


https://tl.telethon.dev/methods/messages/report.html

Example from page:

from telethon.sync import TelegramClient
from telethon import functions, types

with TelegramClient(name, api_id, api_hash) as client:
    result = client(functions.messages.ReportRequest(
        peer='username',
        id=[42],
        reason=types.InputReportReasonSpam()
    ))
    print(result)
like image 40
clubby789 Avatar answered Feb 01 '26 18:02

clubby789