Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Custom Emoji ID Extractor

A professional, stateless utility bot designed for developers to easily extract the custom_emoji_id from any Telegram Premium custom emoji. This tool is essential for building bots that can send or react with custom emojis programmatically.

Bot Demo

Features

  • Universal Extraction: Works with any custom emoji from any pack.
  • Developer-Focused Output: Provides the custom_emoji_id and a ready-to-use code snippet.
  • Privacy by Design: Completely stateless. No database, no file storage, and no message logging.
  • Robust Handling: Correctly parses custom emojis from both text messages and media captions.
  • Clean & Modern Code: Built with python-telegram-bot v20+ using modern async/await syntax.

Why This Bot?

The Telegram Bot API allows bots to send custom emojis, but doing so requires knowing the emoji's unique custom_emoji_id. This ID is not easily accessible through the standard Telegram clients. This bot solves that problem by providing a simple interface to retrieve this ID for any custom emoji you send it.

Prerequisites

  • Python 3.8+
  • A Telegram Bot Token (get one from @BotFather)

Installation & Setup

  1. Clone the repository:

    git clone https://github.com/S0N59/Telegram-Emoji-ID.git
    cd Telegram-Emoji-ID
  2. Create and activate a virtual environment:

    python3 -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Configure your bot token: Copy the example environment file and add your bot token.

    cp .env.example .env

    Now, open the .env file and paste your BOT_TOKEN.

Usage

  1. Run the bot:

    python3 main.py

    The bot will start polling for updates and print a confirmation message to your console.

  2. Interact with the bot on Telegram:

    • Find your bot on Telegram and send /start to see the welcome message.
    • Send any message containing one or more Custom Emojis. (Note: You need a Telegram Premium subscription to send custom emojis).
    • The bot will instantly reply with the custom_emoji_id for each emoji found.

Example Interaction

User sends:

Check out this cool emoji!

Bot replies:

Custom Emojis Detected:

Emoji: ID: 1234567890123456789 Usage: custom_emoji_id="1234567890123456789"

Developer Note: To use this ID in your bot code, pass it to the custom_emoji_id parameter when sending a message entity of type custom_emoji.

How to Use the custom_emoji_id

Here is a practical example of how you would use the extracted ID in your own python-telegram-bot code to send a custom emoji:

from telegram import Update, MessageEntity
from telegram.ext import ContextTypes

async def send_custom_emoji(update: Update, context: ContextTypes.DEFAULT_TYPE):
    text = "Look at this custom emoji! -> "
    
    # The custom_emoji_id you extracted from this bot
    emoji_id = "1234567890123456789"
    
    # The entity that represents the custom emoji in the text
    entity = MessageEntity(
        type="custom_emoji",
        offset=len(text),
        length=2,  # Length of the emoji character(s)
        custom_emoji_id=emoji_id
    )
    
    # The placeholder character(s) for the emoji in the text
    text_with_placeholder = text + "😎" # Use the actual emoji character if known
    
    await context.bot.send_message(
        chat_id=update.effective_chat.id,
        text=text_with_placeholder,
        entities=[entity]
    )

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages