Telethon: get username of channel

Created on 16 Oct 2017  路  12Comments  路  Source: LonamiWebs/Telethon

hi, i want get username of channel but don't exist any method for get channel info that i can found username or channel info

Most helpful comment

Then you call client.get_entity(PeerChannel(id)).

Also next time state that information from the beginning rather than making me ask a hundred times.

All 12 comments

What have you even tried?

yes i tried, do you have any method for this?

I have not asked "did you try?". I asked "what have you tried?".

i tried with GetFullChannelRequest and read solution on git but i cant get username of channel, #155 #176

You just need to get a Channel. That has a .username field. I don't know what your issue is.

thanks, can you write sample of code for get the username of channel?

Sure:

# logic to get a channel
username = channel.username

thanks, i wrote code that get updates and process them, but i have one problem that i don't have username in update.message (i have channel_id in update.message.to_id.channel_id), i tried for get username?

Then you call client.get_entity(PeerChannel(id)).

Also next time state that information from the beginning rather than making me ask a hundred times.

Thank you very much for solving my problem with this code .馃檹馃徎

Hi, I tried to get channel entity from channel id but I always get TypeError: Cannot cast PeerChannel to any kind of InputPeer ?

My code is:
channel=client.get_entity(PeerChannel(update.message.to_id.channel_id))

My code is:
channel=client.get_entity(PeerChannel(update.message.to_id.channel_id))

always get TypeError: Cannot cast PeerChannel to any kind of InputPeer ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pazis picture pazis  路  5Comments

saeedesfandi picture saeedesfandi  路  3Comments

JackCloudman picture JackCloudman  路  6Comments

ghost picture ghost  路  4Comments

adv-zl picture adv-zl  路  3Comments