implemented turtle hello

This commit is contained in:
Lia Schöneweiß
2023-05-04 23:19:29 +02:00
parent e7281da9a2
commit b1525ed5c3
2 changed files with 25 additions and 2 deletions

View File

@@ -1,13 +1,33 @@
import os
from pathlib import Path
from telegram.ext import ConversationHandler, CommandHandler, MessageHandler, filters, CallbackQueryHandler
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram import Update
from .basehandler import BaseHandler
MEDIA_DIR = Path(os.getenv("MEDIA_DIR"))
TURTLE_VIDEO_LOCATION = MEDIA_DIR / "turtle_reactions"
TURTLE_VIDEOS = list(TURTLE_VIDEO_LOCATION.glob("*.mp4"))
class TurtleHandler(BaseHandler):
def __init__(self):
self.entry_string = "Variation of hallo"
self.handler = MessageHandler(filters.Regex(r"Hallo|hallo"), self.entry_point)
pass
async def entry_point(self, update, context):
async def entry_point(self, update: Update, context):
await super().entry_point(update, context)
update.message.reply_
msgtxt = update.message.text
if "hallo" in msgtxt:
vid = TURTLE_VIDEOS[0]
answertxt = "hallo1"
elif "Hallo" in msgtxt:
vid = TURTLE_VIDEOS[1]
answertxt = "Hallo2"
await update.message.reply_video(video=vid, caption=answertxt)
# await update.message.reply_text(text=answertxt)