Skip to main content

Lightweight library for working with Telegram Bot Api + Generate Images, Audio and Text

Project description

Ekogram

Ekogram — лёгкий Python-модуль для Telegram Bot API и работы с нейросетями.
Он объединяет простую работу с Telegram и мощные функции: генерация текста и изображений, перевод и озвучка.

Установка

pip install ekogram

или для macOS:

pip3 install ekogram

Возможности

  • Telegram Bot API: отправка сообщений, медиа, inline, reply клавиатуры и т.п.
  • Мощные AI-инструменты: ИИ, генерация картинок, перевод, озвучка.
  • Поддержка классов Telegram: Message, User, Chat, Audio, Photo, Voice и т.д.
  • Работа с callback_query, inline_query, handlers

🤖 Быстрый старт бота

from ekogram import Bot

bot = Bot("ВАШ_ТОКЕН")

@bot.message_handler(commands=["start"])
def start_handler(message):
    bot.reply_message(chat_id=message.chat.id, text="Привет! Я бот Ekogram!")

bot.polling()

🧠 Использование AI

OnlySQ — бесплатный набор ии; Deef - дополнительные функции

from ekogram import OnlySQ, Deef

gpt = OnlySQ()
gpt2 = Deef()

messages = [
    {"role": "system", "content": "Отвечай кратко и по делу"},
    {"role": "user", "content": "Расскажи, кто такой Эйнштейн?"}
]

print(gpt.generate_answer("gemini-2.5-flash", messages))
print("\n\n"+gpt2.toolchat("hi"))

OnlySQ — генерация картинок

from ekogram import OnlySQ

img = OnlySQ()
print(img.generate_image(prompt="cyberpunk robot with fire"))

Deef — перевод текста

from ekogram import Deef

tr = Deef()
print(tr.translate("Hello, how are you?", target="ru"))

ChatGPT — сессия с GPT

from ekogram import ChatGPT

chat = ChatGPT(url='https://chatgpt.com', headers={})
print(chat.generate_chat_completion(model="gpt-4o-mini", messages=[{"role": 'user', "content": "Hi"}]))

🎤 Озвучка текста

from ekogram import Deef

gpt = Deef()
gpt.speech(text="Привет, как дела?", filename="voice", voice="nova")    #filename -> voice.mp3

📎 Пример кнопок

from ekogram import Bot, Markup

bot = Bot("TOKEN")

@bot.message_handler(commands=["menu"])
def menu(message):
    buttons = [{"text": "Кнопка 1"}, {"text": "Кнопка 2"}]
    markup = Markup.create_reply_keyboard(buttons)
    bot.reply_message(chat_id=message.chat.id, text="Выберите вариант:", reply_markup=markup)

📌 Поддерживаемые классы

  • Telegram: User, Chat, Message, File, Photo, Voice, Video, Sticker, Document, Location, Dice и др.
  • InputMedia: InputMediaPhoto, InputMediaVideo, InputMediaAudio, InputMediaDocument, InputMediaAnimation
  • Inline: InlineQuery, InlineQueryResultArticle, InlineQueryResultPhoto, InlineQueryResultVideo
  • Markup: Markup.create_inline_keyboard(), Markup.create_reply_keyboard(), Markup.remove_reply_keyboard()
  • AI: OnlySQ, Deef, ChatGPT

🔒 Лицензия

MIT License

📫 Обратная связь

Email: siriteamrs@gmail.com

Если возникнут идеи, баги, предложения — пишите 🙌

Project details


Release history Release notifications | RSS feed

This version

2.4

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ekogram-2.4.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ekogram-2.4-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

Details for the file ekogram-2.4.tar.gz.

File metadata

  • Download URL: ekogram-2.4.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for ekogram-2.4.tar.gz
Algorithm Hash digest
SHA256 df7756d34312639de0b1d7cd4fd6d47dfb16ff5fe00423e307da286b10b02755
MD5 a54a61678c65a37ec4c821fe11e2513d
BLAKE2b-256 fce0966ac63e16b642a8e21c0d104d17c908c3804967d3654302a60ef0117f25

See more details on using hashes here.

File details

Details for the file ekogram-2.4-py3-none-any.whl.

File metadata

  • Download URL: ekogram-2.4-py3-none-any.whl
  • Upload date:
  • Size: 28.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for ekogram-2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e713af1232392aa1623324229dec300b4ef63451fb0406bd14ff646aa13acfb7
MD5 12026f6a2410dfd3d3334e5262f1933f
BLAKE2b-256 3f87b9c6ef84504017e4f958f86aca05600343765948128119330edf63503070

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page