Skip to content

Providers

Available

Platform Module Capabilities
Discord chat-platform-discord Moderator, MemberInspector, Interactive, Commands

Enable one with a blank import and reach it by name:

import _ "gitlab.com/phpboyscout/go/chat-platform-discord"

factory, ok := chatplatform.Lookup("discord")

Registered() returns every registered name, sorted — useful for validating a configured platform string and reporting the alternatives.

Writing one

See Author a provider. Providers ship as your own module; nothing is contributed here.

Capability reference

Each is an optional interface on Provider.Actor, found by type assertion. The As* helpers are nil-safe, so they return false rather than panicking on a read-only provider.

Interface Helper Provides
Moderator AsModerator DeleteMessage, TimeoutMember
MemberInspector AsMemberInspector Member, MemberJoined
Interactive AsInteractive Prompt, OpenForm, Respond, UpdateSource, Interactions
Commands AsCommands RegisterCommands

Sentinel errors

Providers return these rather than bespoke errors, so callers handle one set.

Sentinel Meaning
ErrNotConnected the Actor's Reader has no live session
ErrUnsupported the provider cannot honour a request the contract permits
ErrChannelDenied a Ref names a channel outside the allowlist
ErrNotFound a referenced message, thread or member does not exist
ErrAlreadyRegistered a factory is already registered under that name
ErrInvalidName Register was given an empty name
ErrNilFactory Register was given a nil factory

Validation errors from PromptSpec, FormSpec and CommandSpec are also sentinels — ErrDuplicateChoiceKey, ErrEmptyFieldKey and the rest — so a caller can distinguish a malformed spec from a platform refusal.

API

Full godoc: pkg.go.dev/gitlab.com/phpboyscout/go/chat-platform