Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Telegram channel name?

I am using the Telethon library for python. How can I change Telegram channel name? Couldn't find this in documentation.

like image 604
PRAETOR Avatar asked Jul 12 '19 16:07

PRAETOR


1 Answers

For now, you have to use Telethon's raw API. If we search for "edit title" we will find channels.editTitle. Such page has the following automatically-generated example:

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

with TelegramClient(name, api_id, api_hash) as client:
    result = client(functions.channels.EditTitleRequest(
        channel='username',
        title='My awesome title'
    ))
    print(result.stringify())

If you meant the username, channels.updateUsername is the right one:

client(functions.channels.UpdateUsernameRequest(
    channel='old username',
    username='new username'
))

You can of course pass the channel ID or invite link instead of the username if it doesn't have one.

like image 55
Lonami Avatar answered Oct 01 '22 22:10

Lonami