Esempio n. 1
0
 def raw_command(cls, cb, **options):
     cmd = cls(**options)
     try:
         cmd.action = RawFuncAction(cb)
     except:
         log.exception('Uncaught exception in Command.raw_command. catch the following exception manually!')
         cmd.enabled = False
     return cmd
Esempio n. 2
0
 def pajbot_command(cls, bot, method_name, level=1000, **options):
     cmd = cls(**options)
     cmd.level = level
     cmd.description = options.get('description', None)
     cmd.can_execute_with_whisper = True
     try:
         cmd.action = RawFuncAction(getattr(bot, method_name))
     except:
         pass
     return cmd
Esempio n. 3
0
 def pajbot_command(cls,
                    bot: Optional[Bot],
                    method_name: str,
                    level: int = 1000,
                    **options) -> Command:
     cmd = cls(**options)
     cmd.level = level
     cmd.description = options.get("description", None)
     cmd.can_execute_with_whisper = True
     try:
         if bot:
             cmd.action = RawFuncAction(getattr(bot, method_name))
     except:
         pass
     return cmd