<code>from pyrogram.raw.functions.messages import Report
from pyrogram.raw.functions.channels import GetChannels
from pyrogram.raw.types import InputPeerChannel, InputReportReasonSpam
from pyrogram.raw import functions, types
@app.on_message(filters.command('start') & filters.private)
async def start_bot(cleint, mesage):
print('start command')
await mesage.reply_text('hello welcome to my bot', reply_markup=buttons.start())
chat = await app.get_chat('example')
peer = await app.resolve_peer(chat.id)
result = await app.invoke(GetChannels(id=[peer]))
for channel in result.chats:
channel_id =channel.id
access_hash =channel.access_hash
peer = InputPeerChannel(channel_id=channel_id, access_hash=access_hash)
try:
async with Client(":memory:",session_string='session strig ') as bot:
result = await bot.invoke(
functions.messages.Report(
peer = peer,
id=[8409],
reason = InputReportReasonSpam(),
message='hi'
)
)
print(result)
except Exception as e :
print(e)
</code>
<code>from pyrogram.raw.functions.messages import Report
from pyrogram.raw.functions.channels import GetChannels
from pyrogram.raw.types import InputPeerChannel, InputReportReasonSpam
from pyrogram.raw import functions, types
@app.on_message(filters.command('start') & filters.private)
async def start_bot(cleint, mesage):
print('start command')
await mesage.reply_text('hello welcome to my bot', reply_markup=buttons.start())
chat = await app.get_chat('example')
peer = await app.resolve_peer(chat.id)
result = await app.invoke(GetChannels(id=[peer]))
for channel in result.chats:
channel_id =channel.id
access_hash =channel.access_hash
peer = InputPeerChannel(channel_id=channel_id, access_hash=access_hash)
try:
async with Client(":memory:",session_string='session strig ') as bot:
result = await bot.invoke(
functions.messages.Report(
peer = peer,
id=[8409],
reason = InputReportReasonSpam(),
message='hi'
)
)
print(result)
except Exception as e :
print(e)
</code>
from pyrogram.raw.functions.messages import Report
from pyrogram.raw.functions.channels import GetChannels
from pyrogram.raw.types import InputPeerChannel, InputReportReasonSpam
from pyrogram.raw import functions, types
@app.on_message(filters.command('start') & filters.private)
async def start_bot(cleint, mesage):
print('start command')
await mesage.reply_text('hello welcome to my bot', reply_markup=buttons.start())
chat = await app.get_chat('example')
peer = await app.resolve_peer(chat.id)
result = await app.invoke(GetChannels(id=[peer]))
for channel in result.chats:
channel_id =channel.id
access_hash =channel.access_hash
peer = InputPeerChannel(channel_id=channel_id, access_hash=access_hash)
try:
async with Client(":memory:",session_string='session strig ') as bot:
result = await bot.invoke(
functions.messages.Report(
peer = peer,
id=[8409],
reason = InputReportReasonSpam(),
message='hi'
)
)
print(result)
except Exception as e :
print(e)
I also used the option instead of the reason, but it didn’t work
Has anyone had this problem before?
If you have a solution, give an example.
Thank youReport.init() got an unexpected keyword argument ‘reason’
New contributor
daryoush is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.