Skip to content

EN Core Concepts

Andrewkydev edited this page Aug 25, 2026 · 1 revision

Core Concepts

Русский: RU-Core-Concepts

Event flow

  1. The adapter converts an SDK update into an event.Event.
  2. core/app runs global and group middleware.
  3. core/router selects a typed event, command, callback, text, regex, or fallback handler.
  4. The handler uses core/context to send a portable response.
  5. The adapter converts the OutgoingMessage back into an SDK call.

Key boundaries

  • core/* does not import the Telegram, VK, or Discord SDKs.
  • Shared logic works through event.Event, Context, and OutgoingMessage.
  • Platform-only functionality remains in the adapter and is accessed through typed From(ctx) helpers.
  • Plugins are compile-time Go modules, not dynamically loaded binaries.
  • Storage holds persistent data; cache only speeds up access.
  • The admin backend is optional and does not participate in normal routing.

Public facade

The root package is intentionally small:

app := astraengine.New("my-bot")
app.Platform(adapter)
app.Use(middleware)
app.Command("start", handler)
app.Storage(store)
app.Cache(cache)
app.Plugin(plugin)

Import concrete adapters, storage implementations, and advanced contracts only when needed.

Clone this wiki locally