-3

I use Python 3 and python-telegram-bot . The user send a message like this "When i say ... say ...." example : "When i say Hi say Hello " i can take "Hi and Hello" from the message My problem is how to set Hi in bot to when user say hi my bot say Hello

i try to use MessageHandler for example :

MessageHandler(Variable,Callback) 

Variable have hi for example but when i send hi my bot does not send Hello

but when i send hi my bot does not send Hello

ex3p
  • 13
  • 2

1 Answers1

0

Well, you can use an event. on_message should work. Try this:(rewrite)

bot.msg = "Hi" #just create a command in which you would assign a text to bot.msg

   @bot.listen()
    async def on_message(message):
        if message.content.lower() == bot.msg.lower()   #you can set a bot variable, I'll use `bot.msg`
    await message.channel.send("Hello")
Dec0Dedd
  • 335
  • 2
  • 12