feat: added help command
This commit is contained in:
parent
4fc5ae63a1
commit
bd9854676d
10 changed files with 414 additions and 7 deletions
|
@ -261,7 +261,7 @@ func (d *Database) GetChannelPlugins(channelID int64) ([]*model.ChannelPlugin, e
|
|||
}
|
||||
|
||||
// Parse config JSON
|
||||
var config map[string]interface{}
|
||||
var config map[string]any
|
||||
if err := json.Unmarshal([]byte(configJSON), &config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -288,6 +288,28 @@ func (d *Database) GetChannelPlugins(channelID int64) ([]*model.ChannelPlugin, e
|
|||
return plugins, nil
|
||||
}
|
||||
|
||||
// GetChannelPluginsFromPlatformID retrieves all plugins for a channel by platform and platform channel ID
|
||||
func (d *Database) GetChannelPluginsFromPlatformID(platform, platformChannelID string) ([]*model.ChannelPlugin, error) {
|
||||
// First, get the channel ID by platform and platform channel ID
|
||||
query := `
|
||||
SELECT id
|
||||
FROM channels
|
||||
WHERE platform = ? AND platform_channel_id = ?
|
||||
`
|
||||
|
||||
var channelID int64
|
||||
err := d.db.QueryRow(query, platform, platformChannelID).Scan(&channelID)
|
||||
if err == sql.ErrNoRows {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Now get the plugins for this channel
|
||||
return d.GetChannelPlugins(channelID)
|
||||
}
|
||||
|
||||
// GetChannelPluginByID retrieves a channel plugin by ID
|
||||
func (d *Database) GetChannelPluginByID(id int64) (*model.ChannelPlugin, error) {
|
||||
query := `
|
||||
|
@ -626,8 +648,8 @@ func (d *Database) UpdateUserPassword(userID int64, newPassword string) error {
|
|||
func (d *Database) CreateReminder(platform, channelID, messageID, replyToID, userID, username, content string, triggerAt time.Time) (*model.Reminder, error) {
|
||||
query := `
|
||||
INSERT INTO reminders (
|
||||
platform, channel_id, message_id, reply_to_id,
|
||||
user_id, username, created_at, trigger_at,
|
||||
platform, channel_id, message_id, reply_to_id,
|
||||
user_id, username, created_at, trigger_at,
|
||||
content, processed
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 0)
|
||||
`
|
||||
|
@ -666,7 +688,7 @@ func (d *Database) CreateReminder(platform, channelID, messageID, replyToID, use
|
|||
// GetPendingReminders gets all pending reminders that need to be processed
|
||||
func (d *Database) GetPendingReminders() ([]*model.Reminder, error) {
|
||||
query := `
|
||||
SELECT id, platform, channel_id, message_id, reply_to_id,
|
||||
SELECT id, platform, channel_id, message_id, reply_to_id,
|
||||
user_id, username, created_at, trigger_at, content, processed
|
||||
FROM reminders
|
||||
WHERE processed = 0 AND trigger_at <= ?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue