I am using the Telethon library for python. How can I change Telegram channel name? Couldn't find this in documentation.
How to change Telegram channel name?
Asked Answered
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.html –
Barbital
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.
© 2022 - 2024 — McMap. All rights reserved.