Example #1
0
def parse_comand(text, data, bot_id, web_client, channel_id):
    message_handler = MessageHandler(data['channel'])
    user = data['user']

    if ("hello" in text) and (f'@{bot_id.lower()}' in text):
        web_client.chat_postMessage(**message_handler.get_message_hello(user))

    if ("do" in text) and (f'@{bot_id.lower()}' in text):
        print("I found file")
        file_shared(data, web_client, message_handler, channel_id)

    if ("help" in text) and (f'@{bot_id.lower()}' in text):
        web_client.chat_postMessage(**message_handler.get_help_message(user))

    if ("help" not in text) and ("do" not in text) and (
            "hello" not in text):  # изменить на свитч кейс
        web_client.chat_postMessage(
            **message_handler.get_no_such_command_message())
Example #2
0
def on_adiing_user(**payload):
    data = payload['data']
    web_client = payload['web_client']
    message_handler = MessageHandler(data['channel'])
    web_client.chat_postMessage(
        **message_handler.get_help_message(data['user']))