Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import codecs
- cache = []
- def cachequotes(phenny, input):
- file = codecs.open('/root/phenny/oldlogs.txt', 'r', encoding='utf-8')
- for line in file:
- cache.append(line)
- phenny.say(str(len(cache)) + " quotes have been successfully cached.")
- cachequotes.commands = ['cachequotes']
- cachequotes.priority = 'high'
- cachequotes.thread = False
- def oldquote(phenny, input):
- if input.group(2) == None:
- quote = random.choice(cache)
- while not quote.startswith('<'):
- quote = random.choice(cache)
- phenny.say(quote)
- return
- results = []
- for line in cache:
- if input.group(2).lower() in line.lower() and line.startswith('<'):
- results.append(line)
- if not results:
- phenny.say("No quotes found.")
- return
- phenny.say(random.choice(results))
- oldquote.commands = ['oldquote']
- oldquote.priority = 'high'
- oldquote.thread = False
- def searchquote(phenny, input):
- quotes = codecs.open('/root/phenny/madlibs/quote.txt','r',encoding='utf-8').read().splitlines()
- if input.group(2) == None:
- quote = random.choice(quotes)
- phenny.say(quote)
- return
- results = []
- for line in quotes:
- if input.group(2).lower() in line.lower():
- results.append(line)
- if not results:
- phenny.say("No quotes found.")
- return
- phenny.say(random.choice(results))
- searchquote.commands = ['quote']
- searchquote.priority = 'high'
- searchquote.thread = False
- def addquote(phenny, input):
- quotes = codecs.open('/root/phenny/madlibs/quote.txt','a',encoding='utf-8').write('\r\n'+input.group(2))
- phenny.say('Quote added.')
- addquote.commands = ['addquote']
- addquote.priority = 'high'
- addquote.thread = False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement