|
@@ -36,12 +36,19 @@ bot.markov = markov
|
|
@bot.on(NewMessage)
|
|
@bot.on(NewMessage)
|
|
async def on_message(event):
|
|
async def on_message(event):
|
|
peer_id = get_peer_id(event.peer_id)
|
|
peer_id = get_peer_id(event.peer_id)
|
|
|
|
+ text = event.text
|
|
|
|
|
|
try:
|
|
try:
|
|
- command = parse_command(event.text)
|
|
|
|
|
|
+ command = parse_command(text)
|
|
except ValueError:
|
|
except ValueError:
|
|
if await is_markov_enabled(peer_id):
|
|
if await is_markov_enabled(peer_id):
|
|
- markov.extend_corpus(event.text)
|
|
|
|
|
|
+ markov.extend_corpus(text)
|
|
|
|
+
|
|
|
|
+ for word in config.MARKOV_TRIGGER_WORDS:
|
|
|
|
+ if word.lower() in text.lower() and random() > 0.5:
|
|
|
|
+ await markov_say(bot, peer_id, reply_to=event)
|
|
|
|
+
|
|
|
|
+ return
|
|
|
|
|
|
reply_prob = await get_markov_option(peer_id, "opt_reply_prob")
|
|
reply_prob = await get_markov_option(peer_id, "opt_reply_prob")
|
|
|
|
|