示例#1
0
文件: commands.py 项目: rekishi/golem
 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"
示例#2
0
文件: commands.py 项目: rekishi/golem
 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
示例#3
0
文件: commands.py 项目: rekishi/golem
 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"
示例#4
0
文件: commands.py 项目: rekishi/golem
 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
示例#5
0
文件: commands.py 项目: rekishi/golem
 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)
示例#6
0
文件: commands.py 项目: rekishi/golem
 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
示例#7
0
文件: commands.py 项目: rekishi/golem
 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]
示例#8
0
文件: commands.py 项目: rekishi/golem
 def export_doots(self):
     BaseCommands.export_json("/home/sean/golem/data/doots.json",
                              self.doots)
示例#9
0
文件: commands.py 项目: rekishi/golem
 def import_tells(self):
     self.tells = BaseCommands.read_json("/home/sean/golem/data/tells.json")
     if self.tells == None:
         self.tells = {}
示例#10
0
文件: commands.py 项目: apotl/golem
 def export_doots(self):
     BaseCommands.export_json("../data/doots.json", self.doots)
示例#11
0
文件: commands.py 项目: rekishi/golem
 def import_grabs(self):
     self.grabs = BaseCommands.read_json("/home/sean/golem/data/grabs.json")
示例#12
0
文件: commands.py 项目: apotl/golem
 def import_places(self):
     self.places = BaseCommands.read_json("../data/places.json")
示例#13
0
文件: commands.py 项目: rekishi/golem
 def bang(self, target):
     bangs = BaseCommands.read_json("/home/sean/golem/data/bangs.json")
     bang = random.choice(bangs)
     return target + bang
示例#14
0
文件: commands.py 项目: rekishi/golem
 def export_places(self):
     BaseCommands.export_json("/home/sean/golem/data/places.json",
                              self.places)
示例#15
0
文件: commands.py 项目: rekishi/golem
 def import_places(self):
     self.places = BaseCommands.read_json(
         "/home/sean/golem/data/places.json")
示例#16
0
文件: commands.py 项目: rekishi/golem
 def export_grabs(self):
     BaseCommands.export_json("/home/sean/golem/data/grabs.json",
                              self.grabs)
示例#17
0
文件: commands.py 项目: apotl/golem
 def import_grabs(self):
     self.grabs = BaseCommands.read_json("../data/grabs.json")
示例#18
0
文件: commands.py 项目: apotl/golem
 def export_tells(self):
     BaseCommands.export_json("../data/tells.json", self.tells)
示例#19
0
文件: commands.py 项目: apotl/golem
 def export_grabs(self):
     BaseCommands.export_json("../data/grabs.json", self.grabs)
示例#20
0
文件: commands.py 项目: rekishi/golem
 def import_doots(self):
     self.doots = BaseCommands.read_json("/home/sean/golem/data/doots.json")
     if self.doots == None:
         self.doots = {}
示例#21
0
文件: commands.py 项目: apotl/golem
 def export_places(self):
     BaseCommands.export_json("../data/places.json", self.places)
示例#22
0
文件: commands.py 项目: rekishi/golem
 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)
示例#23
0
文件: commands.py 项目: apotl/golem
 def import_tells(self):
     self.tells = BaseCommands.read_json("../data/tells.json")
示例#24
0
文件: commands.py 项目: rekishi/golem
 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"
示例#25
0
文件: commands.py 项目: apotl/golem
 def import_doots(self):
     self.doots = BaseCommands.read_json("../data/doots.json")
示例#26
0
文件: commands.py 项目: rekishi/golem
 def export_tells(self):
     BaseCommands.export_json("/home/sean/golem/data/tells.json",
                              self.tells)