Exemple #1
0
 def __init__(self, g_token):
     self.import_tells()
     self.import_doots()
     self.import_grabs()
     self.import_places()
     self.doot_times = {}
     self.backlog = BaseCommands.read_json(
         "/home/sean/golem/data/backlog.json")
     self.work_tells = BaseCommands.read_json(
         "/home/sean/golem/data/wtells.json")
     self.banlist = BaseCommands.read_json(
         "/home/sean/golem/data/banlist.json")
     if self.banlist is None:
         self.banlist = []
     self.reminds = BaseCommands.read_json(
         "/home/sean/golem/data/reminds.json")
     if self.reminds is None:
         self.reminds = {}
     self.gkey = g_token
Exemple #2
0
 def get_help(self, command):
     if command == "":
         return "usage: help <command> - returns help for <command>. use the 'commands' command to get a list of commands"
     try:
         commands = BaseCommands.read_json(
             "/home/sean/golem/config/commands.json")
         return "usage: " + commands[command]
     except:
         return command + " is not currently supported\n" + self.fuzzy_command(
             command)
Exemple #3
0
 def fuzzy_command(self, inp):
     commands = BaseCommands.read_json(
         "/home/sean/golem/config/commands.json")
     comms = commands.keys()
     best = 0
     ret = ""
     for comm in comms:
         ratio = fuzz.ratio(inp, comm)
         if ratio > best:
             best = ratio
             ret = comm
     return "Closest Command:\n" + commands[ret]
Exemple #4
0
 def import_doots(self):
     self.doots = BaseCommands.read_json("../data/doots.json")
Exemple #5
0
 def import_tells(self):
     self.tells = BaseCommands.read_json("../data/tells.json")
Exemple #6
0
 def import_places(self):
     self.places = BaseCommands.read_json("../data/places.json")
Exemple #7
0
 def import_grabs(self):
     self.grabs = BaseCommands.read_json("../data/grabs.json")
Exemple #8
0
 def add_to_dl_queue(self, link):
     queue = BaseCommands.read_json("/home/sean/golem/data/queue.json")
     queue = [] if queue is None else queue
     queue.append(link)
     BaseCommands.export_json("/home/sean/golem/data/queue.json", queue)
     return "Added " + link + " to download queue"
Exemple #9
0
 def list_commands(self):
     commands = BaseCommands.read_json(
         "/home/sean/golem/config/commands.json")
     ret_com = [x + " usage: " + commands[x] for x in commands.keys()]
     return "\n".join(ret_com)
Exemple #10
0
 def bang(self, target):
     bangs = BaseCommands.read_json("/home/sean/golem/data/bangs.json")
     bang = random.choice(bangs)
     return target + bang
Exemple #11
0
 def import_places(self):
     self.places = BaseCommands.read_json(
         "/home/sean/golem/data/places.json")
Exemple #12
0
 def import_grabs(self):
     self.grabs = BaseCommands.read_json("/home/sean/golem/data/grabs.json")
Exemple #13
0
 def import_doots(self):
     self.doots = BaseCommands.read_json("/home/sean/golem/data/doots.json")
     if self.doots == None:
         self.doots = {}
Exemple #14
0
 def import_tells(self):
     self.tells = BaseCommands.read_json("/home/sean/golem/data/tells.json")
     if self.tells == None:
         self.tells = {}