Example #1
0
def main():
    import dotenv
    import logging
    from importlib import reload
    import slackbot.settings
    import slackbot.bot

    logging.basicConfig(level=logging.DEBUG)
    # overwrite with dotenv
    dotenv.load_dotenv(verbose=True)
    slackbot.bot.settings = reload(slackbot.settings)

    bot = Bot()
    bot.run()
Example #2
0
def main(args=None):
    args = get_parser_args(args)
    _logging_config(args.config)
    logger = logging.getLogger(__name__)

    logger.info("Loading configurations")
    slackbot_config = resources.SlackBotConfig.from_config(args.config)

    # Since we can't inject the settings into the bot, let's load all the settings
    # into the module
    slackbot_config.load_into_settings_module(slackbot.settings)
    # Load the config into the settings...
    # TODO: PR to be able to inject settings instead of auto magically loading them from a module
    slackbot.settings.SLACK_JIRA_CONF = args.config

    logger.info("Starting slackbot")
    bot = slackbot.bot.Bot()
    bot.run()
Example #3
0
    def main(self):
        """bot main"""
        if self.debug:
            self._log_builder.configure_debug_logger()
        else:
            self._log_builder.configure_slack_logger()

        logger = self._log_builder.logger

        logger.info('Hello World')
        api_config.LOGGER = logger
        api_config.CONFIG = CONFIG

        logger.error('STARTING PROSPERBOT -- SLACK %s', platform.node())
        try:
            bot = slackbot.bot.Bot()
            bot.run()
        except Exception:
            logger.critical('Going down in flames!', exc_info=True)
Example #4
0
File: cmd.py Project: w5caa/hambot
def cli():
    """
    HamBot command line function.
    """

    lkw = {
        'format': ('%(asctime)s hambot %(levelname)s '
                   '%(name)s.%(funcName)s:%(lineno)d - %(message)s'),
        'level':
        logging.DEBUG if slackbot.settings.DEBUG else logging.INFO,
        'stream':
        sys.stdout,
    }
    logging.basicConfig(**lkw)
    logging.getLogger('requests.packages.urllib3.connectionpool').setLevel(
        logging.WARNING)

    bot = slackbot.bot.Bot()
    print('Starting HamBot...')
    bot.run()
Example #5
0
def main():
    logging.basicConfig()
    LOGGER = logging.getLogger('slackbot')
    bot = slackbot.bot.Bot()
    bot.run()
Example #6
0
        pass
'''
'''
for pkg in bot._client.rtm_read():
    if 'channel' in pkg and pkg['type'] == 'message':
        if bot._client.channels[pkg['channel']]['name'] == 'random':
#             print(pkg)
            print(pkg['text'])
'''
'''
# @listen_to(r'(\q{5})')
def count_and_send_candidate_answers(message, stop_command):

    result = Counter(vote_result_temp)

    if len(result) == 0:
        message.send("Final Answer: " + candidate_answers_temp[0].get('answer'))
        rc.send_to_channel('from_okcomputer', candidate_answers_temp[0].get('answer'))

    else:
        # count result with max voted number, return it's index
        best_answer_index = max(result, key=result.get)

        # send answer
        message.send("Final Answer: " + candidate_answers_temp[best_answer_index].get('answer'))
        rc.send_to_channel('from_okcomputer', candidate_answers_temp[best_answer_index].get('answer'))

'''
rc.get_all_pkgs()
bot.run()
Example #7
0
def main():
    bot = Bot()
    bot.run()
Example #8
0
def main():
    bot = Bot()
    print('bot is running...')
    bot.run()
Example #9
0
def botrun(bot):
    bot.run()
Example #10
0
def main():
    """ Main function
    """
    bot = slackbot.bot.Bot()
    bot.run()
Example #11
0
def main():
    bot = Bot(rc=rc)
    bot.run()
Example #12
0
def main():
    bot = slackbot.bot.Bot()
    bot.run()
Example #13
0
def main():
    logging.basicConfig()
    LOGGER = logging.getLogger('slackbot')
    bot = slackbot.bot.Bot()
    bot.run()