Debounce rapid messages
Users often send several texts in a row. Debounce perchannelId before calling your model:
Do not block the iterator
app.messages is a single consumer. Offload heavy work to a queue — never await a 30s LLM call inside the loop without accepting that you will miss concurrent messages.