GramJS

messages.SetChatTheme

Change the chat theme of a certain chat

Example

const { Api, TelegramClient } = require("telegram");
const { StringSession } = require("telegram/sessions");

const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()

  const result = await client.invoke(
    new Api.messages.SetChatTheme({
      peer: "username",
      emoticon: "some string here",
    })
  );
  console.log(result); // prints the result
})();
import { Api, TelegramClient } from "telegram";
import { StringSession } from "telegram/sessions";

const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()

  const result: Api.Updates = await client.invoke(
    new Api.messages.SetChatTheme({
      peer: "username",
      emoticon: "some string here",
    })
  );
  console.log(result); // prints the result
})();

Parameters

NameTypeDescription
peerInputPeerPrivate chat where to change theme
emoticonstringEmoji, identifying a specific chat theme; a list of chat themes can be fetched using account.getChatThemes

Result

Updates

Possible errors

CodeTypeDescription
400EMOJI_INVALIDThe specified theme emoji is valid.
400EMOJI_NOT_MODIFIEDThe theme wasn't changed.
400PEER_ID_INVALIDThe provided peer id is invalid.

Can bots use this method?

No

account.getChatThemes

Get all available chat themes