Get sender message if keyword is in it then use part of it

Viewed 94

i want to use a command /price, if only /price is send give price of 1 unit. if its /price 5 give price of 5 units. in normal telegram import i can use this:

def handleCommandPrice(self, update, context):
    message = update.message
    text = message.text
    try:
        priceMultiplier = Decimal(text.replace("/" + COMMAND_PRICE, "").replace(' ', ''))
    except InvalidOperation:
        priceMultiplier = Decimal(1)

    priceMultiplied = getCurrentCoinPrice() * priceMultiplier
    priceMultiplied = round(priceMultiplied, 5)
    
    update.message.reply_text(text = "$ " + str(priceMultiplied), parse_mode=telegram.ParseMode.HTML)

How to make this in Telethon? can you give me an advise or hint please?

Greetings

0 Answers
Related