Documentation
¶
Overview ¶
Package vk implements AstraEngine's VK community bot adapter.
Index ¶
- func From(ctx *botctx.Context) (*api.VK, bool)
- type CallbackEvent
- type Config
- type Platform
- func (p *Platform) AnswerCallback(ctx context.Context, callbackID string, text string) error
- func (p *Platform) Capabilities() capability.Capabilities
- func (p *Platform) DecodeCallback(data []byte) (CallbackEvent, error)
- func (p *Platform) Edit(ctx context.Context, ev event.Event, msg platform.OutgoingMessage) error
- func (p *Platform) EditByRef(ctx context.Context, ref platform.MessageRef, msg platform.OutgoingMessage) error
- func (p *Platform) GetCommunity(ctx context.Context, id string) (platform.Community, error)
- func (p *Platform) GetMembers(ctx context.Context, communityID string) ([]platform.Member, error)
- func (p *Platform) Name() string
- func (p *Platform) Raw() any
- func (p *Platform) Send(ctx context.Context, target platform.Target, msg platform.OutgoingMessage) error
- func (p *Platform) SendPrivate(ctx context.Context, userID string, msg platform.OutgoingMessage) error
- func (p *Platform) SendWithRef(ctx context.Context, target platform.Target, msg platform.OutgoingMessage) (platform.MessageRef, error)
- func (p *Platform) SetCommandPrefixes(prefixes []string)
- func (p *Platform) SetEventTypes(types []event.Type)
- func (p *Platform) SetLogger(logger *slog.Logger)
- func (p *Platform) Start(ctx context.Context, dispatcher platform.Dispatcher) error
- func (p *Platform) Validate() error
- func (p *Platform) WallPost(ctx context.Context, communityID, text string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CallbackEvent ¶
type CallbackEvent struct {
Type events.EventType
GroupID int
EventID string
Secret string
Confirmation bool
Event *event.Event
}
CallbackEvent is a decoded VK Callback API envelope and its normalized event.
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform adapts VK long-poll events and messages to AstraEngine contracts.
func (*Platform) AnswerCallback ¶
func (*Platform) Capabilities ¶
func (p *Platform) Capabilities() capability.Capabilities
func (*Platform) DecodeCallback ¶
func (p *Platform) DecodeCallback(data []byte) (CallbackEvent, error)
DecodeCallback decodes message and confirmation events received through VK Callback API.
func (*Platform) EditByRef ¶
func (p *Platform) EditByRef(ctx context.Context, ref platform.MessageRef, msg platform.OutgoingMessage) error
func (*Platform) GetCommunity ¶
func (*Platform) GetMembers ¶
func (*Platform) SendPrivate ¶ added in v2.0.1
func (*Platform) SendWithRef ¶
func (p *Platform) SendWithRef(ctx context.Context, target platform.Target, msg platform.OutgoingMessage) (platform.MessageRef, error)
func (*Platform) SetCommandPrefixes ¶
func (*Platform) SetEventTypes ¶
SetEventTypes limits VK handlers to the events registered by the app.