Exemple #1
0
 def add_to_backlog(self, item):
     if self.backlog == None:
         self.backlog = []
     self.backlog.append(item)
     BaseCommands.export_json("/home/sean/golem/data/backlog.json",
                              self.backlog)
     return "Added to backlog"
Exemple #2
0
 def check_work_tells(self, sender):
     ret = "Work tells:"
     if sender not in self.work_tells.keys():
         return "No Work tells for this user"
     for tell in self.work_tells[sender]:
         ret += "\n" + tell
     del self.work_tells[sender]
     BaseCommands.export_json("/home/sean/golem/data/wtells.json",
                              self.work_tells)
     return ret
Exemple #3
0
 def work_tell(self, sender, args):
     target = args.split(' ', 1)[0]
     msg = args.split(' ', 1)[1]
     if self.work_tells == None:
         self.work_tells = {}
     if target not in self.work_tells.keys():
         self.work_tells[target] = []
     self.work_tells[target].append(sender + " said " + msg)
     BaseCommands.export_json("/home/sean/golem/data/wtells.json",
                              self.work_tells)
     return "Work tell added"
Exemple #4
0
 def remind(self, sender, args):
     if args is not "":
         if sender not in self.reminds.keys():
             self.reminds[sender] = ""
         self.reminds[sender] = self.reminds[sender] + " " + args
         BaseCommands.export_json("/home/sean/golem/data/reminds.json",
                                  self.reminds)
         return "Added remind"
     else:
         cur_reminds = self.reminds[sender]
         self.reminds[sender] = ""
         BaseCommands.export_json("/home/sean/golem/data/reminds.json",
                                  self.reminds)
         return cur_reminds
Exemple #5
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 #6
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 #7
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 #8
0
 def export_doots(self):
     BaseCommands.export_json("/home/sean/golem/data/doots.json",
                              self.doots)
Exemple #9
0
 def import_tells(self):
     self.tells = BaseCommands.read_json("/home/sean/golem/data/tells.json")
     if self.tells == None:
         self.tells = {}
Exemple #10
0
 def export_doots(self):
     BaseCommands.export_json("../data/doots.json", self.doots)
Exemple #11
0
 def import_grabs(self):
     self.grabs = BaseCommands.read_json("/home/sean/golem/data/grabs.json")
Exemple #12
0
 def import_places(self):
     self.places = BaseCommands.read_json("../data/places.json")
Exemple #13
0
 def bang(self, target):
     bangs = BaseCommands.read_json("/home/sean/golem/data/bangs.json")
     bang = random.choice(bangs)
     return target + bang
Exemple #14
0
 def export_places(self):
     BaseCommands.export_json("/home/sean/golem/data/places.json",
                              self.places)
Exemple #15
0
 def import_places(self):
     self.places = BaseCommands.read_json(
         "/home/sean/golem/data/places.json")
Exemple #16
0
 def export_grabs(self):
     BaseCommands.export_json("/home/sean/golem/data/grabs.json",
                              self.grabs)
Exemple #17
0
 def import_grabs(self):
     self.grabs = BaseCommands.read_json("../data/grabs.json")
Exemple #18
0
 def export_tells(self):
     BaseCommands.export_json("../data/tells.json", self.tells)
Exemple #19
0
 def export_grabs(self):
     BaseCommands.export_json("../data/grabs.json", self.grabs)
Exemple #20
0
 def import_doots(self):
     self.doots = BaseCommands.read_json("/home/sean/golem/data/doots.json")
     if self.doots == None:
         self.doots = {}
Exemple #21
0
 def export_places(self):
     BaseCommands.export_json("../data/places.json", self.places)
Exemple #22
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 #23
0
 def import_tells(self):
     self.tells = BaseCommands.read_json("../data/tells.json")
Exemple #24
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 #25
0
 def import_doots(self):
     self.doots = BaseCommands.read_json("../data/doots.json")
Exemple #26
0
 def export_tells(self):
     BaseCommands.export_json("/home/sean/golem/data/tells.json",
                              self.tells)