Lightweight library for working with Telegram Bot Api + Generate Images, Audio and Text
Project description
Ekogram
Ekogram — лёгкий Python-модуль для Telegram Bot API и работы с нейросетями.
Он объединяет простую работу с Telegram и мощные функции: GPT, генерация изображений, перевод и озвучка.
Установка
pip install ekogram
или для macOS:
pip3 install ekogram
Возможности
- Telegram Bot API: отправка сообщений, медиа, inline, reply клавиатуры и т.п.
- Мощные AI-инструменты: GPT, генерация картинок, перевод, озвучка.
- Поддержка классов 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
FreeGpt — бесплатный GPT
from ekogram import FreeGpt
gpt = FreeGpt()
messages = [
{"role": "system", "content": "Отвечай кратко и по делу"},
{"role": "user", "content": "Расскажи, кто такой Эйнштейн?"}
]
print(gpt.chat(messages))
FreeImg — генерация картинок
from ekogram import FreeImg
img = FreeImg()
print(img.flux_1("cyberpunk robot with fire"))
Translate — перевод текста
from ekogram import Translate
tr = Translate()
print(tr.deepl("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"}]))
🎤 Озвучка текста
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:
FreeGpt,FreeImg,Translate,ChatGPT
🔒 Лицензия
MIT License
📫 Обратная связь
Email: siriteamrs@gmail.com
Если возникнут идеи, баги, предложения — пишите 🙌
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ekogram-0.25.tar.gz.
File metadata
- Download URL: ekogram-0.25.tar.gz
- Upload date:
- Size: 31.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
699598ae089137835cf5c1d3b3411d82b48b976c14fce014b568ec265aad7067
|
|
| MD5 |
f5ae71e514ba2f81d51ec369406616e7
|
|
| BLAKE2b-256 |
0e510d86308c1a2a57a0478a2ad2dd67c7668c04309a19577f128fd5a3e6ca30
|
File details
Details for the file ekogram-0.25-py3-none-any.whl.
File metadata
- Download URL: ekogram-0.25-py3-none-any.whl
- Upload date:
- Size: 30.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d911c949d01a37d5b0f6f4310b85f948abd712b18bbc43f97351d639ef47f5c
|
|
| MD5 |
08f7b81b50bd5a1dc594a51f716115ad
|
|
| BLAKE2b-256 |
5e645d3cc16aec4e8d56b93f3eec82d11f77847df9febbd482b2ad86a435f098
|