Fix markov bot
This commit is contained in:
parent
290c5dea2a
commit
33331181d2
|
@ -4,13 +4,16 @@ import dbtools, twitools
|
||||||
import argparse, markovify, operator, random, re, sys
|
import argparse, markovify, operator, random, re, sys
|
||||||
|
|
||||||
def getText(db = dbtools.dbHelper()):
|
def getText(db = dbtools.dbHelper()):
|
||||||
return '\n'.join(db.executeQuery("SELECT text FROM tweets;"))
|
text = ""
|
||||||
|
for string in db.executeQuery("SELECT text FROM tweets;"):
|
||||||
|
text += string[0] + "\n"
|
||||||
|
return text
|
||||||
|
|
||||||
def markovify(text):
|
def markovifyText(text):
|
||||||
return markovify.Text(text).make_short_sentence(130).replace("@", "@")
|
return markovify.Text(text).make_short_sentence(130).replace("@", "@")
|
||||||
|
|
||||||
def tweet(text, ref = 0, two = twitools.twObject()):
|
def tweet(text, ref = 0, two = twitools.twObject()):
|
||||||
return two.tweet(text, ref).id
|
return two.tweet(text, ref).id
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
tweet(markovify(getText()))
|
tweet(markovifyText(getText()))
|
||||||
|
|
Loading…
Reference in a new issue