23 lines
495 B
Python
23 lines
495 B
Python
import pinhook.plugin as p
|
|
import markovify
|
|
from pyquery import PyQuery as pq
|
|
|
|
"""
|
|
Grab a link, and Markov off the text
|
|
"""
|
|
|
|
def grabber(url):
|
|
p = pq(url=url);
|
|
return markovify.Text(p.text()).make_short_sentence(200);
|
|
|
|
|
|
@p.register('!marko', 'Markov something!')
|
|
def markov(msg):
|
|
if len(msg.arg):
|
|
result = grabber(msg.arg.strip())
|
|
else:
|
|
result = "provide a URL and this command will generate a sentence from it using Markov chains"
|
|
return p.message(result)
|
|
|
|
|