|  | @@ -19,7 +19,7 @@ from actions import (
 | 
	
		
			
				|  |  |      get_markov_option,
 | 
	
		
			
				|  |  |      list_markov_chats,
 | 
	
		
			
				|  |  |      markov_say,
 | 
	
		
			
				|  |  | -    run
 | 
	
		
			
				|  |  | +    run,
 | 
	
		
			
				|  |  |  )
 | 
	
		
			
				|  |  |  from commands import COMMANDS
 | 
	
		
			
				|  |  |  from markov import Markov
 | 
	
	
		
			
				|  | @@ -38,11 +38,16 @@ bot.markov = markov
 | 
	
		
			
				|  |  |  async def on_inline_query(event):
 | 
	
		
			
				|  |  |      text = event.text.strip()
 | 
	
		
			
				|  |  |      if not text:
 | 
	
		
			
				|  |  | -      return
 | 
	
		
			
				|  |  | +        return
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    result = await run(text)
 | 
	
		
			
				|  |  | +    result = f"```{text.replace('`', '')}```\n{result}"
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    await event.answer([
 | 
	
		
			
				|  |  | -        event.builder.article("Результат.", text=await run(text)),
 | 
	
		
			
				|  |  | -    ])
 | 
	
		
			
				|  |  | +    await event.answer(
 | 
	
		
			
				|  |  | +        [
 | 
	
		
			
				|  |  | +            event.builder.article("Результат.", text=result),
 | 
	
		
			
				|  |  | +        ]
 | 
	
		
			
				|  |  | +    )
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @bot.on(NewMessage)
 | 
	
	
		
			
				|  | @@ -57,16 +62,18 @@ async def on_message(event):
 | 
	
		
			
				|  |  |              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)
 | 
	
		
			
				|  |  | +                if word.lower() in text.lower() and random() > 0.5:
 | 
	
		
			
				|  |  | +                    await markov_say(bot, peer_id, reply_to=event)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                return
 | 
	
		
			
				|  |  | +                    return
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              reply_prob = await get_markov_option(peer_id, "opt_reply_prob")
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              reply = await event.get_reply_message()
 | 
	
		
			
				|  |  |              if (
 | 
	
		
			
				|  |  | -                reply and get_peer_id(reply.from_id) == await bot.get_peer_id("me") and random() > 0.5
 | 
	
		
			
				|  |  | +                reply
 | 
	
		
			
				|  |  | +                and get_peer_id(reply.from_id) == await bot.get_peer_id("me")
 | 
	
		
			
				|  |  | +                and random() > 0.5
 | 
	
		
			
				|  |  |              ) or random() > reply_prob:
 | 
	
		
			
				|  |  |                  await markov_say(bot, peer_id, reply_to=event)
 | 
	
		
			
				|  |  |  
 |