Reporting Abuse & Content¶
Telegram provides native mechanisms to report spam, abuse, intellectual property violations, and harmful content. Tobigram provides high-level client methods and convenient bound methods for all reportable entities across Telegram’s MTProto API.
from pyrogram import Client
from pyrogram.enums import ReportReason
app = Client("my_account")
async with app:
# Report a channel for spam
await app.report_chat("@spammer_channel", ReportReason.SPAM)
Available Reasons¶
The ReportReason enumeration defines all 10 official reason categories
supported by Telegram:
Reason Enum |
Description |
|---|---|
|
Unsolicited bulk messages, spam bots, or advertisements. |
|
Physical threats, violence, or incitement to harm. |
|
Explicit adult, NSFW, or non-consensual sexual content. |
|
Child sexual abuse and child exploitation material. |
|
Unauthorized copyright or intellectual property infringements. |
|
Irrelevant or promotional content posted in location-based chats. |
|
Impersonation, fake profiles, phishing, or financial fraud. |
|
Sale or promotion of illegal narcotics and banned substances. |
|
Doxxing, privacy violations, or unauthorized leaks of personal data. |
|
Any custom reason; accompanied by an explanatory message comment. |
Reporting Chats and Channels¶
Use report_chat() to report an entire group, supergroup, or channel:
await app.report_chat(
chat_id="@scam_channel",
reason=ReportReason.FAKE,
message="Impersonating our official service"
)
For quick 1-click spam dismissal on incoming unapproved dialogues, use report_spam():
await app.report_spam(chat_id)
Reporting Messages¶
Use report_messages() to report one or more specific messages in a chat:
await app.report_messages(
chat_id=chat_id,
message_ids=[123, 124],
reason=ReportReason.SPAM,
message="Automated affiliate link spam"
)
Supergroup administrators reporting specific participant spam can pass the participant argument:
await app.report_messages(
chat_id=chat_id,
message_ids=message_id,
participant=user_id
)
Reporting Users and Profile Photos¶
Use report_user() to report a user profile directly:
await app.report_user(user_id, ReportReason.SPAM)
Use report_profile_photo() to report an offensive profile photo:
user = await app.get_users("bad_actor")
if user.photo:
await app.report_profile_photo(
chat_id=user.id,
photo=user.photo.big_file_id,
reason=ReportReason.PORNOGRAPHY
)
Reporting Stories and Reactions¶
To report user or channel stories, use report_story():
await app.report_story(chat_id, story_id, ReportReason.SPAM)
To report abusive or offensive emoji reactions left on messages, use report_reaction():
await app.report_reaction(chat_id, message_id, reaction_peer)
Bound Methods Shortcut¶
Models in Tobigram include bound shortcuts for cleaner, object-oriented syntax:
# Bound method on Chat
await chat.report(ReportReason.SPAM)
await chat.report_spam()
# Bound method on User
await user.report(ReportReason.FAKE)
# Bound method on Message
await message.report(ReportReason.VIOLENCE)
# Bound method on Story
await story.report(ReportReason.PORNOGRAPHY)