This commit is contained in:
parent
21e4c434fd
commit
72c6dd6982
12 changed files with 695 additions and 48 deletions
|
@ -6,25 +6,25 @@ import (
|
|||
|
||||
// Message represents a chat message
|
||||
type Message struct {
|
||||
Text string
|
||||
Chat string
|
||||
Channel *Channel
|
||||
Author string
|
||||
FromBot bool
|
||||
Date time.Time
|
||||
ID string
|
||||
ReplyTo string
|
||||
Raw map[string]interface{}
|
||||
Text string
|
||||
Chat string
|
||||
Channel *Channel
|
||||
Author string
|
||||
FromBot bool
|
||||
Date time.Time
|
||||
ID string
|
||||
ReplyTo string
|
||||
Raw map[string]interface{}
|
||||
}
|
||||
|
||||
// Channel represents a chat channel
|
||||
type Channel struct {
|
||||
ID int64
|
||||
Platform string
|
||||
ID int64
|
||||
Platform string
|
||||
PlatformChannelID string
|
||||
ChannelRaw map[string]interface{}
|
||||
Enabled bool
|
||||
Plugins map[string]*ChannelPlugin
|
||||
ChannelRaw map[string]interface{}
|
||||
Enabled bool
|
||||
Plugins map[string]*ChannelPlugin
|
||||
}
|
||||
|
||||
// HasEnabledPlugin checks if a plugin is enabled for this channel
|
||||
|
@ -40,18 +40,18 @@ func (c *Channel) HasEnabledPlugin(pluginID string) bool {
|
|||
func (c *Channel) ChannelName() string {
|
||||
// In a real implementation, this would use the platform-specific
|
||||
// ParseChannelNameFromRaw function
|
||||
|
||||
|
||||
// For simplicity, we'll just use the PlatformChannelID if we can't extract a name
|
||||
// Check if ChannelRaw has a name field
|
||||
if c.ChannelRaw == nil {
|
||||
return c.PlatformChannelID
|
||||
}
|
||||
|
||||
|
||||
// Check common name fields in ChannelRaw
|
||||
if name, ok := c.ChannelRaw["name"].(string); ok && name != "" {
|
||||
return name
|
||||
}
|
||||
|
||||
|
||||
// Check for nested objects like "chat" (used by Telegram)
|
||||
if chat, ok := c.ChannelRaw["chat"].(map[string]interface{}); ok {
|
||||
// Try different fields in order of preference
|
||||
|
@ -65,7 +65,7 @@ func (c *Channel) ChannelName() string {
|
|||
return firstName
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return c.PlatformChannelID
|
||||
}
|
||||
|
||||
|
@ -83,4 +83,19 @@ type User struct {
|
|||
ID int64
|
||||
Username string
|
||||
Password string
|
||||
}
|
||||
}
|
||||
|
||||
// Reminder represents a scheduled reminder
|
||||
type Reminder struct {
|
||||
ID int64
|
||||
Platform string
|
||||
ChannelID string
|
||||
MessageID string
|
||||
ReplyToID string
|
||||
UserID string
|
||||
Username string
|
||||
CreatedAt time.Time
|
||||
TriggerAt time.Time
|
||||
Content string
|
||||
Processed bool
|
||||
}
|
||||
|
|
|
@ -13,16 +13,16 @@ var (
|
|||
type Plugin interface {
|
||||
// GetID returns the plugin ID
|
||||
GetID() string
|
||||
|
||||
|
||||
// GetName returns the plugin name
|
||||
GetName() string
|
||||
|
||||
|
||||
// GetHelp returns the plugin help text
|
||||
GetHelp() string
|
||||
|
||||
|
||||
// RequiresConfig indicates if the plugin requires configuration
|
||||
RequiresConfig() bool
|
||||
|
||||
|
||||
// OnMessage processes an incoming message and returns response messages
|
||||
OnMessage(msg *Message, config map[string]interface{}) []*Message
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue