Components

A unit of processing within a flow

Components are elements that are run at a single step in a BFML flow. There are built-in flows and you have the ability to write custom components in Python.

Python Example

import datetime

from dataclasses import dataclass
from meya.component.element import Component
from meya.element.field import response_field
from meya.entry import Entry
from typing import List


@dataclass
class TimeNowComponent(Component):
    @dataclass
    class Response:
        result: str = response_field()

    async def start(self) -> List[Entry]:
        result = str(datetime.datetime.utcnow())
        return self.respond(data=self.Response(result=result))

BFML Usage

See line 6

triggers:
  - keyword: ping

steps:
  - type: component.time.now
  - say: pong (@ flow.result )