PRAETOR
PRAETOR

Reputation: 53

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.

Upvotes: 5

Views: 4830

Answers (1)

Lonami
Lonami

Reputation: 7086

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.

Upvotes: 7

Related Questions