https://core.telegram.org/bots/api
On the website with updates for the Telegram Bot API, there's a new feature "message effect". A unique effect ID is required, but it's not mentioned anywhere where to get it. Does anyone have any ideas?
Thanks for starting this question!
Still no docs on message effcts, and moreover it at the moment of 20.06.2024 I faced an INVALID_EFFECT_ID
error from Telegram Server when my bot sending some kind of "success" messages. But! With "fail" effects everything works fine without any exceptions.
Here are the ids, which I use for "success" and "fail" messages:
SUCCESS_EFFECT_IDS: Final[list[str]] = [
"5104841245755180586", # 🔥
"5107584321108051014", # 👍
"5044134455711629726", # ❤️
"5046509860389126442", # 🎉
]
FAIL_EFFECT_IDS: Final[list[str]] = [
"5104858069142078462", # 👎
"5046589136895476101", # 💩
]
I contacted Telegram Support, but I don't think they can help with API-related problems.
[Will reply here on their feedback]
UPD 20.06.2024: Made some researches, so ...
Everyone can use 6 free effects, while Telegram Premium unlocks hundreds more – including all the effects from Premium stickers.
Six mentioned effects are: it's clear link generated by stackoverflow, sorry just not enough reputation :/
Other effects can be reached by bot if he is a subscriber of Telegram Premium. I was not interested in how this is implemented, but this article will probably help those needed.
I'm using Python 3.12 + Aiogram 3.7.0 framework for bot development and I found a simple solution how to get effect_id:
import concurrent.futures
from aiogram import Bot, Dispatcher
from aiogram.client.default import DefaultBotProperties
from aiogram.enums import ParseMode
from aiogram.types import Message
from config import TG_TOKEN as TOKEN # your bot token
dp = Dispatcher()
bot = Bot(
token=TOKEN,
default=DefaultBotProperties(
parse_mode=ParseMode.HTML
)
)
@dp.message()
async def print_effect_id(message: Message):
# Simple message_effect_id get-and-print function
# Each time you send message with effect to your bot, it will print the effect_id property to the terminal
print(message.effect_id)
async def main() -> None:
await dp.start_polling(bot)
if __name__ == "__main__":
asyncio.run(main())
And here I got broken effect_id that was mentioned before upd:
SUCCESS_EFFECT_IDS: Final[list[str]] = [
"...", # 🔥 - still works
"...", # 👍 - still works
"5159385139981059251", # ❤️ - fixed one
"...", # 🎉 - still works
]
[Still no answer from Telegram Support...]