How to change Telegram channel name?
Asked Answered
M

1

5

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

Mastership answered 12/7, 2019 at 16:1 Comment(1)
Documentation states if something is not present in API, you can call Telegram methods via low-level interface: docs.telethon.dev/en/latest/concepts/full-api.htmlBarbital
B
7

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.

Belike answered 12/7, 2019 at 16:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.