platform

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package platform defines adapter contracts and platform-neutral outbound messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Community

type Community struct {
	ID       string
	Platform string
	Title    string
	Kind     string
	Raw      any
}

Community is a platform-neutral group, guild or community.

type CommunityManagement

type CommunityManagement interface {
	GetCommunity(ctx context.Context, id string) (Community, error)
	GetMembers(ctx context.Context, communityID string) ([]Member, error)
}

CommunityManagement exposes optional community lookup operations.

type Dispatcher

type Dispatcher interface {
	Dispatch(ctx context.Context, ev event.Event) error
}

Dispatcher accepts normalized events from adapters.

type Member

type Member struct {
	ID       string
	Username string
	Roles    []string
	Raw      any
}

Member is a normalized community member.

type MessageEditor

type MessageEditor interface {
	Edit(ctx context.Context, ev event.Event, msg OutgoingMessage) error
}

MessageEditor is an optional platform capability for editing the message related to an incoming event (typically callback events).

type MessageEditorByRef

type MessageEditorByRef interface {
	EditByRef(ctx context.Context, ref MessageRef, msg OutgoingMessage) error
}

MessageEditorByRef is an optional platform capability for editing messages via explicit message references.

type MessageRef

type MessageRef = event.MessageRef

MessageRef is a platform-agnostic reference to an existing message. Platforms may use different fields depending on capabilities.

type MessageSenderWithRef

type MessageSenderWithRef interface {
	SendWithRef(ctx context.Context, target Target, msg OutgoingMessage) (MessageRef, error)
}

MessageSenderWithRef is an optional platform capability for sending messages and returning a reference that can be used for later edits.

type Migratable

type Migratable interface {
	Migrations() []plugin.Migration
}

type OutgoingMessage

type OutgoingMessage struct {
	Text        string
	Keyboard    *keyboard.Keyboard
	Attachments []attachments.Attachment
	ReplyTo     *MessageRef
	Raw         any
}

OutgoingMessage contains portable message content and optional native data.

type Platform

type Platform interface {
	Name() string
	Capabilities() capability.Capabilities
	Start(ctx context.Context, dispatcher Dispatcher) error
	Send(ctx context.Context, target Target, msg OutgoingMessage) error
	AnswerCallback(ctx context.Context, callbackID string, text string) error
	Raw() any
}

Platform is implemented by every concrete messaging adapter.

type Target

type Target struct {
	ChatID string
	UserID string
}

Target identifies the destination of an outgoing message.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL