Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 How to make a telegram bot respond to the specific word in a sentence?
#1
So, I'm trying to make my bot respond whenever a certain word is said in a sentence (the language is Serbian), so I made this code:

if (message.text.lower().find('lav') != -1):
        bot.send_message(message.chat.id,  "Najgore pivo...")
Now, the bot is doing what I would like, when some somebody says:

"Popio sam lav"

it responds as it should.
But, the problem is that the word "lav" is also part in other words, for example:

"Nebo je plavo"

so the bot responds here as well and I want to block that.

I am just starting to play with python, so I would really appreciate help, tnx :)
Quote

Top Page

Messages In This Thread
How to make a telegram bot respond to the specific word in a sentence? - by Metodolog - Dec-02-2019, 07:44 PM

Possibly Related Threads...
Thread Author Replies Views Last Post
  Delete specific lines contain specific words mannyi 2 172 Nov-04-2019, 04:50 PM
Last Post: mannyi
  print a word after specific word search evilcode1 8 221 Oct-22-2019, 08:08 AM
Last Post: newbieAuggie2019
  Sentence maker help bidoofis 2 451 Feb-08-2019, 03:59 AM
Last Post: bidoofis
  wont print last sentence.. mitmit293 2 352 Jan-27-2019, 05:38 PM
Last Post: aakashjha001
  PigLatin Sentence Translator Help 2skywalkers 7 1,557 Jun-23-2018, 12:46 AM
Last Post: 2skywalkers
  Question about telegram bot Romank 0 589 Mar-29-2018, 09:36 PM
Last Post: Romank
  difference between word: and word[:] in for loop zowhair 2 935 Mar-03-2018, 07:24 AM
Last Post: zowhair
  Telegram code help AaronJonk 0 1,318 Oct-05-2017, 02:44 PM
Last Post: AaronJonk
  Python Speech recognition, word by word AceScottie 5 6,598 Aug-21-2017, 12:37 PM
Last Post: DeaD_EyE
  How to make a script to find a certain word in text files in a whole directory ? RandoomDude 2 3,389 Apr-27-2017, 10:27 AM
Last Post: wavic

Forum Jump:


Users browsing this thread: 1 Guest(s)