For example, i wrote a simple echo-bot, but GetFullChannel is not working.
from pyrogram import Client, filters, enums
from pyrogram.raw import functions, types
app = Client(username, api_id, api_hash)
@app.on_message(filters.text)
async def echo(client, message):
if message.text == "test":
r = await app.invoke(functions.channels.GetFullChannel(channel=-100********21))
print(r)
My code failed and return this trace:
Traceback (most recent call last):
File "/home/******/.local/lib/python3.9/site-packages/pyrogram/dispatcher.py", line 240, in handler_worker
await handler.callback(self.client, *args)
File "**************.py", line 84, in echo
ret = await app.invoke(functions.channels.GetFullChannel(channel=-100********21))
File "/home/*****/.local/lib/python3.9/site-packages/pyrogram/methods/advanced/invoke.py", line 77, in invoke
r = await self.session.invoke(
File "/home/*****/.local/lib/python3.9/site-packages/pyrogram/session/session.py", line 361, in invoke
return await self.send(query, timeout=timeout)
File "/home/******/.local/lib/python3.9/site-packages/pyrogram/session/session.py", line 290, in send
message = self.msg_factory(data)
File "/home/*****/.local/lib/python3.9/site-packages/pyrogram/session/internals/msg_factory.py", line 37, in __call__
len(body)
File "/home/*****/.local/lib/python3.9/site-packages/pyrogram/raw/core/tl_object.py", line 79, in __len__
return len(self.write())
File "/home/******/.local/lib/python3.9/site-packages/pyrogram/raw/functions/channels/get_full_channel.py", line 69, in write
b.write(self.channel.write())
AttributeError: 'int' object has no attribute 'write'
The author of the Pyrogram framework says that there is no error in the libraries themselves, it is in my implementation.
Can you tell me what is wrong in my code? Am I using the raw function incorrectly?
you should give InputChannel
not peer id of it
Test :
channel = await app.resolve_peer(-100********21)
r = await app.invoke(functions.channels.GetFullChannel(channel=channel ))