Documentation
¶
Index ¶
- func FormatURLForDiscord(rawURL string) string
- type DiscordEmbed
- type DiscordMessage
- type DiscordPlatform
- func (d *DiscordPlatform) Connect(ctx context.Context) error
- func (d *DiscordPlatform) CreateDM(ctx context.Context, userID string) (string, error)
- func (d *DiscordPlatform) Disconnect() error
- func (d *DiscordPlatform) GetBotInfo() (string, string)
- func (d *DiscordPlatform) GetChannelMessages(ctx context.Context, channelID string, limit int) ([]Message, error)
- func (d *DiscordPlatform) IsConnected() bool
- func (d *DiscordPlatform) JoinVoiceChannel(ctx context.Context, guildID, channelID string) error
- func (d *DiscordPlatform) LeaveVoiceChannel(ctx context.Context) error
- func (d *DiscordPlatform) Name() string
- func (d *DiscordPlatform) Receive(ctx context.Context) (<-chan Message, error)
- func (d *DiscordPlatform) Send(ctx context.Context, channelID string, message Message) error
- func (d *DiscordPlatform) SendWebhook(ctx context.Context, webhookURL string, message Message) error
- func (d *DiscordPlatform) SetWebhook(ctx context.Context, webhookURL string) error
- type DiscordWebhookPayload
- type EmailPlatform
- func (e *EmailPlatform) Connect(ctx context.Context) error
- func (e *EmailPlatform) Disconnect() error
- func (e *EmailPlatform) IsConnected() bool
- func (e *EmailPlatform) Name() string
- func (e *EmailPlatform) Receive(ctx context.Context) (<-chan Message, error)
- func (e *EmailPlatform) Send(ctx context.Context, to string, msg Message) error
- type Gateway
- type GatewayConfig
- type MatrixPlatform
- func (m *MatrixPlatform) Connect(ctx context.Context) error
- func (m *MatrixPlatform) Disconnect() error
- func (m *MatrixPlatform) IsConnected() bool
- func (m *MatrixPlatform) JoinRoom(ctx context.Context, roomID string) error
- func (m *MatrixPlatform) Name() string
- func (m *MatrixPlatform) Receive(ctx context.Context) (<-chan Message, error)
- func (m *MatrixPlatform) Send(ctx context.Context, roomID string, msg Message) error
- type Media
- type Message
- type Platform
- type PlatformConfig
- type SMSPlatform
- func (s *SMSPlatform) Connect(ctx context.Context) error
- func (s *SMSPlatform) Disconnect() error
- func (s *SMSPlatform) IsConnected() bool
- func (s *SMSPlatform) Name() string
- func (s *SMSPlatform) Receive(ctx context.Context) (<-chan Message, error)
- func (s *SMSPlatform) Send(ctx context.Context, to string, msg Message) error
- type SignalPlatform
- func (s *SignalPlatform) Connect(ctx context.Context) error
- func (s *SignalPlatform) Disconnect() error
- func (s *SignalPlatform) IsConnected() bool
- func (s *SignalPlatform) Name() string
- func (s *SignalPlatform) Receive(ctx context.Context) (<-chan Message, error)
- func (s *SignalPlatform) Send(ctx context.Context, recipient string, msg Message) error
- type TelegramChat
- type TelegramMessage
- type TelegramPlatform
- func (t *TelegramPlatform) Connect(ctx context.Context) error
- func (t *TelegramPlatform) Disconnect() error
- func (t *TelegramPlatform) GetFileURL(fileID string) (string, error)
- func (t *TelegramPlatform) IsConnected() bool
- func (t *TelegramPlatform) Name() string
- func (t *TelegramPlatform) Receive(ctx context.Context) (<-chan Message, error)
- func (t *TelegramPlatform) Send(ctx context.Context, chatID string, message Message) error
- func (t *TelegramPlatform) SetWebhook(ctx context.Context, webhookURL string) error
- type TelegramUpdate
- type TelegramUser
- type User
- type WhatsAppMedia
- type WhatsAppMessage
- type WhatsAppPlatform
- func (w *WhatsAppPlatform) Connect(ctx context.Context) error
- func (w *WhatsAppPlatform) Disconnect() error
- func (w *WhatsAppPlatform) IsConnected() bool
- func (w *WhatsAppPlatform) Name() string
- func (w *WhatsAppPlatform) Receive(ctx context.Context) (<-chan Message, error)
- func (w *WhatsAppPlatform) Send(ctx context.Context, to string, msg Message) error
- type WhatsAppText
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatURLForDiscord ¶
FormatURLForDiscord creates a Discord-friendly URL
Types ¶
type DiscordEmbed ¶
type DiscordEmbed struct {
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Image *struct {
URL string `json:"url,omitempty"`
} `json:"image,omitempty"`
Thumbnail *struct {
URL string `json:"url,omitempty"`
} `json:"thumbnail,omitempty"`
}
DiscordEmbed represents a Discord embed
type DiscordMessage ¶
type DiscordMessage struct {
Content string `json:"content,omitempty"`
Embeds []DiscordEmbed `json:"embeds,omitempty"`
File *multipart.File `json:"-"`
Filename string `json:"-"`
}
DiscordMessage represents a Discord message payload
type DiscordPlatform ¶
type DiscordPlatform struct {
// contains filtered or unexported fields
}
DiscordPlatform implements Discord messaging
func NewDiscordPlatform ¶
func NewDiscordPlatform(token string) *DiscordPlatform
NewDiscordPlatform creates a new Discord platform
func (*DiscordPlatform) Connect ¶
func (d *DiscordPlatform) Connect(ctx context.Context) error
Connect establishes connection to Discord
func (*DiscordPlatform) Disconnect ¶
func (d *DiscordPlatform) Disconnect() error
Disconnect closes the connection
func (*DiscordPlatform) GetBotInfo ¶
func (d *DiscordPlatform) GetBotInfo() (string, string)
GetBotInfo returns bot information
func (*DiscordPlatform) GetChannelMessages ¶
func (d *DiscordPlatform) GetChannelMessages(ctx context.Context, channelID string, limit int) ([]Message, error)
GetChannelMessages gets messages from a channel
func (*DiscordPlatform) IsConnected ¶
func (d *DiscordPlatform) IsConnected() bool
IsConnected returns connection status
func (*DiscordPlatform) JoinVoiceChannel ¶
func (d *DiscordPlatform) JoinVoiceChannel(ctx context.Context, guildID, channelID string) error
JoinVoiceChannel joins a voice channel
func (*DiscordPlatform) LeaveVoiceChannel ¶
func (d *DiscordPlatform) LeaveVoiceChannel(ctx context.Context) error
LeaveVoiceChannel leaves the current voice channel
func (*DiscordPlatform) Name ¶
func (d *DiscordPlatform) Name() string
Name returns the platform name
func (*DiscordPlatform) Receive ¶
func (d *DiscordPlatform) Receive(ctx context.Context) (<-chan Message, error)
Receive receives messages (polling - for webhook mode)
func (*DiscordPlatform) SendWebhook ¶
func (d *DiscordPlatform) SendWebhook(ctx context.Context, webhookURL string, message Message) error
SendWebhook sends a message via webhook
func (*DiscordPlatform) SetWebhook ¶
func (d *DiscordPlatform) SetWebhook(ctx context.Context, webhookURL string) error
SetWebhook sets up webhook for this platform
type DiscordWebhookPayload ¶
type DiscordWebhookPayload struct {
Content string `json:"content,omitempty"`
Embeds []DiscordEmbed `json:"embeds,omitempty"`
}
DiscordWebhookPayload represents a Discord webhook payload
type EmailPlatform ¶
type EmailPlatform struct {
// contains filtered or unexported fields
}
EmailPlatform implements Email messaging
func NewEmailPlatform ¶
func NewEmailPlatform(smtpHost string, smtpPort int, username, password, fromAddr string) *EmailPlatform
NewEmailPlatform creates a new Email platform
func (*EmailPlatform) Connect ¶
func (e *EmailPlatform) Connect(ctx context.Context) error
Connect establishes connection to SMTP server
func (*EmailPlatform) Disconnect ¶
func (e *EmailPlatform) Disconnect() error
Disconnect closes the connection
func (*EmailPlatform) IsConnected ¶
func (e *EmailPlatform) IsConnected() bool
IsConnected returns connection status
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway manages multiple platforms
func (*Gateway) GetPlatform ¶
GetPlatform returns a platform by name
func (*Gateway) ListPlatforms ¶
ListPlatforms returns all registered platforms
type GatewayConfig ¶
type GatewayConfig struct {
Port int `json:"port"`
Platforms []PlatformConfig `json:"platforms"`
AllowedUsers []string `json:"allowed_users"`
AutoReply bool `json:"auto_reply"`
VoiceReply bool `json:"voice_reply"`
}
GatewayConfig holds gateway configuration
type MatrixPlatform ¶
type MatrixPlatform struct {
// contains filtered or unexported fields
}
MatrixPlatform implements Matrix messaging
func NewMatrixPlatform ¶
func NewMatrixPlatform(homeserver, userID, accessToken string) *MatrixPlatform
NewMatrixPlatform creates a new Matrix platform
func (*MatrixPlatform) Connect ¶
func (m *MatrixPlatform) Connect(ctx context.Context) error
Connect establishes connection to Matrix
func (*MatrixPlatform) Disconnect ¶
func (m *MatrixPlatform) Disconnect() error
Disconnect closes the connection
func (*MatrixPlatform) IsConnected ¶
func (m *MatrixPlatform) IsConnected() bool
IsConnected returns connection status
func (*MatrixPlatform) JoinRoom ¶
func (m *MatrixPlatform) JoinRoom(ctx context.Context, roomID string) error
JoinRoom joins a Matrix room
type Media ¶
type Media struct {
Type string `json:"type"` // voice, photo, video, document, image
URL string `json:"url"`
FileID string `json:"file_id,omitempty"`
MimeType string `json:"mime_type,omitempty"`
Size int64 `json:"size,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Duration int `json:"duration,omitempty"`
Caption string `json:"caption,omitempty"`
}
Media represents attached media
type Message ¶
type Message struct {
ID string `json:"id"`
ChatID string `json:"chat_id"`
Text string `json:"text"`
Timestamp time.Time `json:"timestamp"`
From User `json:"from"`
Media *Media `json:"media,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
Message represents a platform-agnostic message
type Platform ¶
type Platform interface {
Name() string
Connect(ctx context.Context) error
Disconnect() error
IsConnected() bool
Send(ctx context.Context, chatID string, message Message) error
Receive(ctx context.Context) (<-chan Message, error)
}
Platform defines the interface for messaging platforms
type PlatformConfig ¶
type PlatformConfig struct {
Type string `json:"type"` // telegram, discord, slack, etc.
Token string `json:"token,omitempty"`
Config map[string]interface{} `json:"config,omitempty"`
}
PlatformConfig holds individual platform configuration
type SMSPlatform ¶
type SMSPlatform struct {
// contains filtered or unexported fields
}
SMSPlatform implements SMS messaging
func NewSMSPlatform ¶
func NewSMSPlatform(apiKey, apiURL, from string) *SMSPlatform
NewSMSPlatform creates a new SMS platform
func (*SMSPlatform) Connect ¶
func (s *SMSPlatform) Connect(ctx context.Context) error
Connect establishes connection to SMS gateway
func (*SMSPlatform) Disconnect ¶
func (s *SMSPlatform) Disconnect() error
Disconnect closes the connection
func (*SMSPlatform) IsConnected ¶
func (s *SMSPlatform) IsConnected() bool
IsConnected returns connection status
type SignalPlatform ¶
type SignalPlatform struct {
// contains filtered or unexported fields
}
SignalPlatform implements Signal messaging
func NewSignalPlatform ¶
func NewSignalPlatform(serviceURL, username, password string) *SignalPlatform
NewSignalPlatform creates a new Signal platform
func (*SignalPlatform) Connect ¶
func (s *SignalPlatform) Connect(ctx context.Context) error
Connect establishes connection to Signal
func (*SignalPlatform) Disconnect ¶
func (s *SignalPlatform) Disconnect() error
Disconnect closes the connection
func (*SignalPlatform) IsConnected ¶
func (s *SignalPlatform) IsConnected() bool
IsConnected returns connection status
type TelegramChat ¶
type TelegramChat struct {
ID int64 `json:"id"`
Type string `json:"type"`
Username string `json:"username"`
Title string `json:"title"`
}
TelegramChat represents a Telegram chat
type TelegramMessage ¶
type TelegramMessage struct {
ChatID int64 `json:"chat_id"`
Text string `json:"text"`
ParseMode string `json:"parse_mode,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
}
TelegramMessage represents a Telegram message payload
type TelegramPlatform ¶
type TelegramPlatform struct {
// contains filtered or unexported fields
}
TelegramPlatform implements Telegram messaging
func NewTelegramPlatform ¶
func NewTelegramPlatform(token string) *TelegramPlatform
NewTelegramPlatform creates a new Telegram platform
func (*TelegramPlatform) Connect ¶
func (t *TelegramPlatform) Connect(ctx context.Context) error
Connect establishes connection to Telegram
func (*TelegramPlatform) Disconnect ¶
func (t *TelegramPlatform) Disconnect() error
Disconnect closes the connection
func (*TelegramPlatform) GetFileURL ¶
func (t *TelegramPlatform) GetFileURL(fileID string) (string, error)
GetFileURL gets the URL for a file
func (*TelegramPlatform) IsConnected ¶
func (t *TelegramPlatform) IsConnected() bool
IsConnected returns connection status
func (*TelegramPlatform) Name ¶
func (t *TelegramPlatform) Name() string
Name returns the platform name
func (*TelegramPlatform) Receive ¶
func (t *TelegramPlatform) Receive(ctx context.Context) (<-chan Message, error)
Receive receives messages (polling)
func (*TelegramPlatform) SetWebhook ¶
func (t *TelegramPlatform) SetWebhook(ctx context.Context, webhookURL string) error
SetWebhook sets up webhook for this platform
type TelegramUpdate ¶
type TelegramUpdate struct {
UpdateID int64 `json:"update_id"`
Message *struct {
MessageID int64 `json:"message_id"`
From TelegramUser `json:"from"`
Chat TelegramChat `json:"chat"`
Text string `json:"text"`
Date int64 `json:"date"`
Voice *struct {
FileID string `json:"file_id"`
Duration int `json:"duration"`
MimeType string `json:"mime_type"`
FileSize int `json:"file_size"`
} `json:"voice"`
Photo []struct {
FileID string `json:"file_id"`
Width int `json:"width"`
Height int `json:"height"`
} `json:"photo"`
Video *struct {
FileID string `json:"file_id"`
Width int `json:"width"`
Height int `json:"height"`
Duration int `json:"duration"`
} `json:"video"`
Document *struct {
FileID string `json:"file_id"`
FileName string `json:"file_name"`
MimeType string `json:"mime_type"`
FileSize int `json:"file_size"`
} `json:"document"`
Caption string `json:"caption"`
} `json:"message"`
}
TelegramUpdate represents a Telegram update
type TelegramUser ¶
type TelegramUser struct {
ID int64 `json:"id"`
Username string `json:"username"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Language string `json:"language_code"`
}
TelegramUser represents a Telegram user
type User ¶
type User struct {
ID string `json:"id"`
Username string `json:"username,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Language string `json:"language,omitempty"`
IsBot bool `json:"is_bot,omitempty"`
}
User represents a platform-agnostic user
type WhatsAppMedia ¶
type WhatsAppMedia struct {
Link string `json:"link,omitempty"`
Caption string `json:"caption,omitempty"`
ID string `json:"id,omitempty"`
Provider string `json:"provider,omitempty"`
}
WhatsAppMedia represents WhatsApp media message
type WhatsAppMessage ¶
type WhatsAppMessage struct {
MessagingProduct string `json:"messaging_product"`
To string `json:"to"`
Type string `json:"type"`
Text *WhatsAppText `json:"text,omitempty"`
Image *WhatsAppMedia `json:"image,omitempty"`
Audio *WhatsAppMedia `json:"audio,omitempty"`
Video *WhatsAppMedia `json:"video,omitempty"`
Document *WhatsAppMedia `json:"document,omitempty"`
}
WhatsAppMessage represents a WhatsApp message payload
type WhatsAppPlatform ¶
type WhatsAppPlatform struct {
// contains filtered or unexported fields
}
WhatsAppPlatform implements WhatsApp messaging
func NewWhatsAppPlatform ¶
func NewWhatsAppPlatform(phoneID, apiKey string) *WhatsAppPlatform
NewWhatsAppPlatform creates a new WhatsApp platform
func (*WhatsAppPlatform) Connect ¶
func (w *WhatsAppPlatform) Connect(ctx context.Context) error
Connect establishes connection to WhatsApp
func (*WhatsAppPlatform) Disconnect ¶
func (w *WhatsAppPlatform) Disconnect() error
Disconnect closes the connection
func (*WhatsAppPlatform) IsConnected ¶
func (w *WhatsAppPlatform) IsConnected() bool
IsConnected returns connection status
func (*WhatsAppPlatform) Name ¶
func (w *WhatsAppPlatform) Name() string
Name returns the platform name
type WhatsAppText ¶
type WhatsAppText struct {
PreviewURL bool `json:"preview_url,omitempty"`
Body string `json:"body"`
}
WhatsAppText represents WhatsApp text message