コード例 #1
0
ファイル: command.py プロジェクト: TalVivian/pajbot
 def from_json(cls, json):
     cmd = cls()
     if 'level' in json:
         cmd.level = json['level']
     cmd.action = ActionParser.parse(data=json['action'],
                                     command=cmd.command)
     return cmd
コード例 #2
0
 def set(self, **options):
     self.level = options.get('level', self.level)
     if 'action' in options:
         self.action_json = json.dumps(options['action'])
         self.action = ActionParser.parse(self.action_json)
     if 'extra_args' in options:
         self.extra_args = {'command': self}
         self.extra_args.update(options['extra_args'])
         self.extra_extra_args = json.dumps(options['extra_args'])
     self.command = options.get('command', self.command)
     self.description = options.get('description', self.description)
     self.delay_all = options.get('delay_all', self.delay_all)
     if self.delay_all < 0:
         self.delay_all = 0
     self.delay_user = options.get('delay_user', self.delay_user)
     if self.delay_user < 0:
         self.delay_user = 0
     self.enabled = options.get('enabled', self.enabled)
     self.cost = options.get('cost', self.cost)
     if self.cost < 0:
         self.cost = 0
     self.tokens_cost = options.get('tokens_cost', self.tokens_cost)
     if self.tokens_cost < 0:
         self.tokens_cost = 0
     self.can_execute_with_whisper = options.get(
         'can_execute_with_whisper', self.can_execute_with_whisper)
     self.sub_only = options.get('sub_only', self.sub_only)
     self.mod_only = options.get('mod_only', self.mod_only)
     self.examples = options.get('examples', self.examples)
     self.run_in_thread = options.get('run_in_thread', self.run_in_thread)
コード例 #3
0
ファイル: command.py プロジェクト: Cophy08/pajbot
 def set(self, **options):
     self.level = options.get('level', self.level)
     if 'action' in options:
         self.action_json = json.dumps(options['action'])
         self.action = ActionParser.parse(self.action_json)
     if 'extra_args' in options:
         self.extra_args = {'command': self}
         self.extra_args.update(options['extra_args'])
         self.extra_extra_args = json.dumps(options['extra_args'])
     self.command = options.get('command', self.command)
     self.description = options.get('description', self.description)
     self.delay_all = options.get('delay_all', self.delay_all)
     if self.delay_all < 0:
         self.delay_all = 0
     self.delay_user = options.get('delay_user', self.delay_user)
     if self.delay_user < 0:
         self.delay_user = 0
     self.enabled = options.get('enabled', self.enabled)
     self.cost = options.get('cost', self.cost)
     if self.cost < 0:
         self.cost = 0
     self.tokens_cost = options.get('tokens_cost', self.tokens_cost)
     if self.tokens_cost < 0:
         self.tokens_cost = 0
     self.can_execute_with_whisper = options.get('can_execute_with_whisper', self.can_execute_with_whisper)
     self.sub_only = options.get('sub_only', self.sub_only)
     self.mod_only = options.get('mod_only', self.mod_only)
     self.examples = options.get('examples', self.examples)
コード例 #4
0
ファイル: command.py プロジェクト: sgaweda/troybot
 def set(self, **options):
     self.level = options.get("level", self.level)
     if "action" in options:
         self.action_json = json.dumps(options["action"])
         self.action = ActionParser.parse(self.action_json,
                                          command=self.command)
     if "extra_args" in options:
         self.extra_args = {"command": self}
         self.extra_args.update(options["extra_args"])
         self.extra_extra_args = json.dumps(options["extra_args"])
     self.command = options.get("command", self.command)
     self.description = options.get("description", self.description)
     self.delay_all = options.get("delay_all", self.delay_all)
     if self.delay_all < 0:
         self.delay_all = 0
     self.delay_user = options.get("delay_user", self.delay_user)
     if self.delay_user < 0:
         self.delay_user = 0
     self.enabled = options.get("enabled", self.enabled)
     self.cost = options.get("cost", self.cost)
     if self.cost < 0:
         self.cost = 0
     self.tokens_cost = options.get("tokens_cost", self.tokens_cost)
     if self.tokens_cost < 0:
         self.tokens_cost = 0
     self.can_execute_with_whisper = options.get(
         "can_execute_with_whisper", self.can_execute_with_whisper)
     self.sub_only = options.get("sub_only", self.sub_only)
     self.mod_only = options.get("mod_only", self.mod_only)
     self.run_through_banphrases = options.get("run_through_banphrases",
                                               self.run_through_banphrases)
     self.examples = options.get("examples", self.examples)
     self.run_in_thread = options.get("run_in_thread", self.run_in_thread)
     self.notify_on_error = options.get("notify_on_error",
                                        self.notify_on_error)
コード例 #5
0
ファイル: command.py プロジェクト: sgaweda/troybot
 def from_json(cls, json_object):
     cmd = cls()
     if "level" in json_object:
         cmd.level = json_object["level"]
     cmd.action = ActionParser.parse(data=json_object["action"],
                                     command=cmd.command)
     return cmd
コード例 #6
0
 def set(self, **options: Any) -> None:
     self.level = options.get("level", self.level)
     action_dict = options.get("action", None)
     if action_dict:
         self.action_json = json.dumps(action_dict)
         self.action = ActionParser.parse(str_data=self.action_json,
                                          command=self.command)
     self.command = options.get("command", self.command)
     self.description = options.get("description", self.description)
     self.delay_all = options.get("delay_all", self.delay_all)
     if self.delay_all < 0:
         self.delay_all = 0
     self.delay_user = options.get("delay_user", self.delay_user)
     if self.delay_user < 0:
         self.delay_user = 0
     self.enabled = options.get("enabled", self.enabled)
     self.cost = options.get("cost", self.cost)
     if self.cost < 0:
         self.cost = 0
     self.tokens_cost = options.get("tokens_cost", self.tokens_cost)
     if self.tokens_cost < 0:
         self.tokens_cost = 0
     self.can_execute_with_whisper = options.get(
         "can_execute_with_whisper", self.can_execute_with_whisper)
     self.sub_only = options.get("sub_only", self.sub_only)
     self.mod_only = options.get("mod_only", self.mod_only)
     self.run_through_banphrases = options.get("run_through_banphrases",
                                               self.run_through_banphrases)
     self.examples = options.get("examples", self.examples)
     self.run_in_thread = options.get("run_in_thread", self.run_in_thread)
     self.notify_on_error = options.get("notify_on_error",
                                        self.notify_on_error)
     self.use_global_cd = options.get("use_global_cd", self.use_global_cd)
コード例 #7
0
ファイル: command.py プロジェクト: gigglearrows/pajbot
 def set(self, **options):
     self.level = options.get("level", self.level)
     if "action" in options:
         self.action_json = json.dumps(options["action"])
         self.action = ActionParser.parse(self.action_json)
     if "extra_args" in options:
         self.extra_args = {"command": self}
         self.extra_args.update(options["extra_args"])
         self.extra_extra_args = json.dumps(options["extra_args"])
     self.command = options.get("command", self.command)
     self.description = options.get("description", self.description)
     self.delay_all = options.get("delay_all", self.delay_all)
     if self.delay_all < 0:
         self.delay_all = 0
     self.delay_user = options.get("delay_user", self.delay_user)
     if self.delay_user < 0:
         self.delay_user = 0
     self.enabled = options.get("enabled", self.enabled)
     self.cost = options.get("cost", self.cost)
     if self.cost < 0:
         self.cost = 0
     self.can_execute_with_whisper = options.get("can_execute_with_whisper", self.can_execute_with_whisper)
     self.sub_only = options.get("sub_only", self.sub_only)
     self.mod_only = options.get("mod_only", self.mod_only)
     self.examples = options.get("examples", self.examples)
コード例 #8
0
ファイル: command.py プロジェクト: Cophy08/pajbot
 def init_on_load(self):
     self.last_run = 0
     self.last_run_by_user = {}
     self.extra_args = {'command': self}
     self.action = ActionParser.parse(self.action_json)
     if self.extra_extra_args:
         try:
             self.extra_args.update(json.loads(self.extra_extra_args))
         except:
             log.exception('Unhandled exception caught while loading Command extra arguments ({0})'.format(self.extra_extra_args))
コード例 #9
0
ファイル: timer.py プロジェクト: Nacht123/pajbot
 def set(self, **options):
     self.name = options.get('name', self.name)
     log.debug(options)
     if 'action' in options:
         log.info('new action!')
         self.action_json = json.dumps(options['action'])
         self.action = ActionParser.parse(self.action_json)
     self.interval_online = options.get('interval_online', self.interval_online)
     self.interval_offline = options.get('interval_offline', self.interval_offline)
     self.enabled = options.get('enabled', self.enabled)
コード例 #10
0
 def set(self, **options):
     self.name = options.get("name", self.name)
     log.debug(options)
     if "action" in options:
         log.info("new action!")
         self.action_json = json.dumps(options["action"])
         self.action = ActionParser.parse(self.action_json)
     self.interval_online = options.get("interval_online", self.interval_online)
     self.interval_offline = options.get("interval_offline", self.interval_offline)
     self.enabled = options.get("enabled", self.enabled)
コード例 #11
0
 def init_on_load(self):
     self.last_run = 0
     self.last_run_by_user = {}
     self.extra_args = {'command': self}
     self.action = ActionParser.parse(self.action_json)
     if self.extra_extra_args:
         try:
             self.extra_args.update(json.loads(self.extra_extra_args))
         except:
             log.exception('Unhandled exception caught while loading Command extra arguments ({0})'.format(self.extra_extra_args))
コード例 #12
0
ファイル: timer.py プロジェクト: wijayantoap/bullbot
 def set(self, **options):
     self.name = options.get('name', self.name)
     log.debug(options)
     if 'action' in options:
         log.info('new action!')
         self.action_json = json.dumps(options['action'])
         self.action = ActionParser.parse(self.action_json)
     self.interval_online = options.get('interval_online', self.interval_online)
     self.interval_offline = options.get('interval_offline', self.interval_offline)
     self.enabled = options.get('enabled', self.enabled)
コード例 #13
0
ファイル: command.py プロジェクト: zneix/pajbot
 def init_on_load(self):
     self.last_run = 0
     self.last_run_by_user = {}
     self.extra_args = {"command": self}
     self.action = ActionParser.parse(self.action_json, command=self.command)
     self.run_in_thread = False
     if self.extra_extra_args:
         try:
             self.extra_args.update(json.loads(self.extra_extra_args))
         except:
             log.exception(
                 f"Unhandled exception caught while loading Command extra arguments ({self.extra_extra_args})"
             )
コード例 #14
0
ファイル: filter.py プロジェクト: polle-vanhoof/pajbot
 def init_on_load(self):
     self.action_parsed_json = json.loads(self.action_json)
     self.action = ActionParser.parse(self.action_json)
     self.extra_args = {'filter': self}
     self.regex = None
     if self.extra_extra_args:
         try:
             self.extra_args.update(json.loads(self.extra_extra_args))
         except:
             log.exception('Unhandled exception caught while loading Filter extra arguments ({0})'.format(self.extra_extra_args))
     try:
         self.regex = re.compile(self.filter.lower())
     except Exception:
         log.exception('Uncaught exception in filter {0}'.format(self.name))
コード例 #15
0
ファイル: filter.py プロジェクト: Neclord9/pajbot
 def init_on_load(self):
     self.action_parsed_json = json.loads(self.action_json)
     self.action = ActionParser.parse(self.action_json)
     self.extra_args = {'filter': self}
     self.regex = None
     if self.extra_extra_args:
         try:
             self.extra_args.update(json.loads(self.extra_extra_args))
         except:
             log.exception('Unhandled exception caught while loading Filter extra arguments ({0})'.format(self.extra_extra_args))
     try:
         self.regex = re.compile(self.filter.lower())
     except Exception:
         log.exception('Uncaught exception in filter {0}'.format(self.name))
コード例 #16
0
ファイル: filter.py プロジェクト: Neclord9/pajbot
 def set(self, **options):
     self.extra_args = {'filter': self}
     if 'name' in options:
         self.name = options['name']
     if 'action' in options:
         self.action_json = json.dumps(options['action'])
         self.action_parsed_json = options['action']
         self.action = ActionParser.parse(self.action_json)
     if 'filter' in options:
         self.filter = options['filter']
     if 'type' in options:
         self.type = options['type']
     if 'extra_args' in options:
         self.extra_extra_args = json.dumps(options['extra_args'])
         self.extra_args.update(options['extra_args'])
     if 'enabled' in options:
         self.enabled = options['enabled']
     if 'num_users' in options:
         self.num_uses = options['num_uses']
コード例 #17
0
 def set(self, **options):
     self.extra_args = {'filter': self}
     if 'name' in options:
         self.name = options['name']
     if 'action' in options:
         self.action_json = json.dumps(options['action'])
         self.action_parsed_json = options['action']
         self.action = ActionParser.parse(self.action_json)
     if 'filter' in options:
         self.filter = options['filter']
     if 'type' in options:
         self.type = options['type']
     if 'extra_args' in options:
         self.extra_extra_args = json.dumps(options['extra_args'])
         self.extra_args.update(options['extra_args'])
     if 'enabled' in options:
         self.enabled = options['enabled']
     if 'num_users' in options:
         self.num_uses = options['num_uses']
コード例 #18
0
 def dispatch_command(cls, cb, **options):
     cmd = cls(**options)
     cmd.action = ActionParser.parse('{"type": "func", "cb": "' + cb + '"}')
     return cmd
コード例 #19
0
 def dispatch_command(cls, cb: Any, **options: Any) -> Command:
     cmd = cls(**options)
     cmd.action = ActionParser.parse('{"type": "func", "cb": "' + cb + '"}',
                                     command=cmd.command)
     return cmd
コード例 #20
0
ファイル: timer.py プロジェクト: Nacht123/pajbot
    def init_on_load(self):
        self.action = ActionParser.parse(self.action_json)

        self.refresh_tts()
コード例 #21
0
ファイル: command.py プロジェクト: Cophy08/pajbot
 def dispatch_command(cls, cb, **options):
     cmd = cls(**options)
     cmd.action = ActionParser.parse('{"type": "func", "cb": "' + cb + '"}')
     return cmd
コード例 #22
0
ファイル: command.py プロジェクト: Cophy08/pajbot
 def from_json(cls, json):
     cmd = cls()
     if 'level' in json:
         cmd.level = json['level']
     cmd.action = ActionParser.parse(data=json['action'])
     return cmd
コード例 #23
0
ファイル: timer.py プロジェクト: Nacht123/pajbot
 def refresh_action(self):
     self.action = ActionParser.parse(self.action_json)
コード例 #24
0
ファイル: timer.py プロジェクト: alazymeme/pajbot
 def refresh_action(self):
     self.action = ActionParser.parse(self.action_json)
コード例 #25
0
ファイル: timer.py プロジェクト: alazymeme/pajbot
    def init_on_load(self):
        self.action = ActionParser.parse(self.action_json)

        self.refresh_tts()
コード例 #26
0
ファイル: command.py プロジェクト: gigglearrows/pajbot
 def from_json(cls, json):
     cmd = cls()
     if "level" in json:
         cmd.level = json["level"]
     cmd.action = ActionParser.parse(data=json["action"])
     return cmd