INNER CODE UNIT · Python

respond_to_new_message

seratch/ChatGPT-in-Slack · app/bolt_listeners.py:283

def respond_to_new_message(
    context: BoltContext,
    payload: dict,
    client: WebClient,
    logger: logging.Logger,
):
    if payload.get("bot_id") is not None and payload.get("bot_id") != context.bot_id:
        # Skip a new message by a different app
        return

    openai_api_key = context.get("OPENAI_API_KEY")
    if openai_api_key is None:
        return

    wip_reply = None
    try:
        is_in_dm_with_bot = payload.get("channel_type") == "im"
        is_thread_for_this_app = False

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…