simple bot for getting media info

This commit is contained in:
Hubert Bryłkowski 2023-07-09 15:30:10 +02:00 committed by Piotr Gaczkowski
parent 8c420af0af
commit 27798e6e54
3 changed files with 31 additions and 2 deletions

View file

@ -0,0 +1,26 @@
import os
from telegram.ext import CommandHandler, ApplicationBuilder
from labeler.app.labeler import Application
from labeler.infra.e550w_printer.printer import E550W
from labeler.infra.renderer import PILRenderer
class LabelingBot:
def __init__(self, app):
self.app = app
async def media_info(self, update, context):
media = self.app.get_installed_media()
await update.message.reply_text(f"Installed media: {media.description}")
if __name__ == "__main__":
application = Application(PILRenderer(), E550W(os.environ.get("PRINTER_IP")))
bot = LabelingBot(application)
app = ApplicationBuilder().token(os.environ["TELEGRAM_TOKEN"]).build()
app.add_handler(CommandHandler("media_info", bot.media_info))
app.run_polling()