示例#1
0
    def init(self, bot: ChatbotEngine):
        """

        :param bot:
        :return:
        """
        self.bot = bot
        self.logger = DotFlow2LoggerAdapter(logging.getLogger('df2_ext.template_e'), self, self.bot, 'Jinja2')
示例#2
0
    def init(self, bot: ChatbotEngine):
        """
        Initialize chatbot engine

        :param bot:
        :return:
        """
        self.bot = bot
        self.logger = DotFlow2LoggerAdapter(logging.getLogger('df2_ext.csMatch'), self, self.bot, '$chatscriptMatch')
        bot.register_dotflow2_function('chatscriptMatch', {'object': self, 'method': 'chatscriptMatch', 'cost': 0, 'register_enabled': False})
示例#3
0
    def init(self, bot: ChatbotEngine):
        """
        Initialize extension

        :param bot:
        :return:
        """
        self.bot = bot
        self.logger = DotFlow2LoggerAdapter(logging.getLogger('df2_ext.ssent_an'), self, self.bot, '$simpleSentimentAnalysis')
        bot.register_dotflow2_function('simpleSentimentAnalysis', {'object': self, 'method': 'df2_simpleSentimentAnalysis', 'cost': 0.5, 'register_enabled': True})
示例#4
0
    def init(self, bot: ChatbotEngine):
        """

        :param bot:
        :return:
        """
        self.bot = bot
        self.logger = DotFlow2LoggerAdapter(
            logging.getLogger('df2_ext.weather'), self, self.bot, '$weather')
        bot.register_dotflow2_function('weather', {
            'object': self,
            'method': 'df2_weather'
        })
        bot.register_template_function('weather', {
            'object': self,
            'method': 'df2_weather'
        })
示例#5
0
    def init(self, bot: ChatbotEngine):
        """

        :param bot:
        :return:
        """
        self.bot = bot
        self.logger = DotFlow2LoggerAdapter(
            logging.getLogger('df2_ext.ssent_an'), self, self.bot,
            '$simpleSentimentAnalysis')
        bot.register_dotflow2_function('simpleSentimentAnalysis', {
            'object': self,
            'method': 'df2_simpleSentimentAnalysis'
        })
        bot.register_template_function('simpleSentimentAnalysis', {
            'object': self,
            'method': 'df2_simpleSentimentAnalysis'
        })
示例#6
0
    def init(self, bot: ChatbotEngine):

        self.bot = bot
        self.logger = DotFlow2LoggerAdapter(logging.getLogger('df2_ext.core'),
                                            self, self.bot, 'DF2CoreFnc')

        self.functions = [
            'input', 'eq', 'gt', 'lt', 'gte', 'lte', 'code', 'goto', 'return',
            'set', 'get', 'regexMatch', 'and', 'or'
        ]

        for f in self.functions:
            bot.register_dotflow2_function(
                f, {
                    'object': self,
                    'method': 'df2_' + f,
                    'cost': 0,
                    'register_enabled': False
                })
示例#7
0
    def init(self, bot: ChatbotEngine):
        """
        Initializes extension

        :param bot:
        :return:
        """
        self.bot = bot
        self.logger = DotFlow2LoggerAdapter(
            logging.getLogger('df2_ext.r_output'), self, self.bot,
            'Output Response Ext')

        for f in self.functions:
            bot.register_dotflow2_function(f, {
                'object': self,
                'method': 'df2_' + f
            })
            bot.register_template_function(f, {
                'object': self,
                'method': 'df2_' + f
            })