當前位置: 首頁>>代碼示例>>Python>>正文


Python ActionParser.parse方法代碼示例

本文整理匯總了Python中pajbot.models.action.ActionParser.parse方法的典型用法代碼示例。如果您正苦於以下問題:Python ActionParser.parse方法的具體用法?Python ActionParser.parse怎麽用?Python ActionParser.parse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pajbot.models.action.ActionParser的用法示例。


在下文中一共展示了ActionParser.parse方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: set

# 需要導入模塊: from pajbot.models.action import ActionParser [as 別名]
# 或者: from pajbot.models.action.ActionParser import parse [as 別名]
 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)
開發者ID:Cophy08,項目名稱:pajbot,代碼行數:30,代碼來源:command.py

示例2: set

# 需要導入模塊: from pajbot.models.action import ActionParser [as 別名]
# 或者: from pajbot.models.action.ActionParser import parse [as 別名]
 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)
開發者ID:gigglearrows,項目名稱:pajbot,代碼行數:27,代碼來源:command.py

示例3: init_on_load

# 需要導入模塊: from pajbot.models.action import ActionParser [as 別名]
# 或者: from pajbot.models.action.ActionParser import parse [as 別名]
 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))
開發者ID:Cophy08,項目名稱:pajbot,代碼行數:12,代碼來源:command.py

示例4: set

# 需要導入模塊: from pajbot.models.action import ActionParser [as 別名]
# 或者: from pajbot.models.action.ActionParser import parse [as 別名]
 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)
開發者ID:Nacht123,項目名稱:pajbot,代碼行數:12,代碼來源:timer.py

示例5: init_on_load

# 需要導入模塊: from pajbot.models.action import ActionParser [as 別名]
# 或者: from pajbot.models.action.ActionParser import parse [as 別名]
 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))
開發者ID:Neclord9,項目名稱:pajbot,代碼行數:16,代碼來源:filter.py

示例6: set

# 需要導入模塊: from pajbot.models.action import ActionParser [as 別名]
# 或者: from pajbot.models.action.ActionParser import parse [as 別名]
 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']
開發者ID:Neclord9,項目名稱:pajbot,代碼行數:21,代碼來源:filter.py

示例7: dispatch_command

# 需要導入模塊: from pajbot.models.action import ActionParser [as 別名]
# 或者: from pajbot.models.action.ActionParser import parse [as 別名]
 def dispatch_command(cls, cb, **options):
     cmd = cls(**options)
     cmd.action = ActionParser.parse('{"type": "func", "cb": "' + cb + '"}')
     return cmd
開發者ID:Cophy08,項目名稱:pajbot,代碼行數:6,代碼來源:command.py

示例8: from_json

# 需要導入模塊: from pajbot.models.action import ActionParser [as 別名]
# 或者: from pajbot.models.action.ActionParser import parse [as 別名]
 def from_json(cls, json):
     cmd = cls()
     if 'level' in json:
         cmd.level = json['level']
     cmd.action = ActionParser.parse(data=json['action'])
     return cmd
開發者ID:Cophy08,項目名稱:pajbot,代碼行數:8,代碼來源:command.py

示例9: refresh_action

# 需要導入模塊: from pajbot.models.action import ActionParser [as 別名]
# 或者: from pajbot.models.action.ActionParser import parse [as 別名]
 def refresh_action(self):
     self.action = ActionParser.parse(self.action_json)
開發者ID:Nacht123,項目名稱:pajbot,代碼行數:4,代碼來源:timer.py

示例10: init_on_load

# 需要導入模塊: from pajbot.models.action import ActionParser [as 別名]
# 或者: from pajbot.models.action.ActionParser import parse [as 別名]
    def init_on_load(self):
        self.action = ActionParser.parse(self.action_json)

        self.refresh_tts()
開發者ID:Nacht123,項目名稱:pajbot,代碼行數:6,代碼來源:timer.py


注:本文中的pajbot.models.action.ActionParser.parse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。