Esempio n. 1
0
import json, os, sys
import config, plugin_manager

all_modules = plugin_manager.load()


def listen(request):
    """Processes Slack bot messages.

    Args:
        request (object): the Flask request object, including the the form-
             encoded message fields which Slack POSTs

    Returns:
        bool: result object if successful, False otherwise.
    """

    if config.log: print('listening...')

    # Grab every key/value from the POST and stuff it into a dict
    message = {}
    for key, value in request.form.items():
        message[key] = value
    print(message)

    # Token check, unless in debugging mode
    if (message['token'] not in config.tokens) and not config.debug:
        if config.log: print('abort 500: token is not familiar')
        abort(500)

    # Try each module in order, by calling its consider() method
Esempio n. 2
0
def main():
    app, mainForm, window = MainForm.init()
    block_dict = plugin_manager.load()
    mainForm.set_blocks(block_dict)
    window.show()
    sys.exit(app.exec_())