fix: resolve linting issues in VK channel

- Format VKConfig struct tags to comply with golines
- Remove unused mu sync.Mutex field
- Remove unused stripPrefix method

All tests passing ✓
This commit is contained in:
linhaolin1 2026-04-02 18:51:29 +08:00
parent 39377a21ff
commit ee49136002
2 changed files with 6 additions and 17 deletions

View file

@ -5,7 +5,6 @@ import (
"fmt"
"strconv"
"strings"
"sync"
"github.com/SevereCloud/vksdk/v3/api"
"github.com/SevereCloud/vksdk/v3/api/params"
@ -27,7 +26,6 @@ type VKChannel struct {
config *config.Config
ctx context.Context
cancel context.CancelFunc
mu sync.Mutex
}
func NewVKChannel(cfg *config.Config, bus *bus.MessageBus) (*VKChannel, error) {
@ -244,15 +242,6 @@ func (c *VKChannel) stripBotMention(text string) string {
return strings.TrimSpace(text)
}
func (c *VKChannel) stripPrefix(text string, prefixes []string) string {
for _, prefix := range prefixes {
if strings.HasPrefix(text, prefix) {
return strings.TrimSpace(strings.TrimPrefix(text, prefix))
}
}
return text
}
func (c *VKChannel) getUserName(userID int) string {
users, err := c.vk.UsersGet(api.Params{
"user_ids": userID,

View file

@ -549,14 +549,14 @@ type IRCConfig struct {
}
type VKConfig struct {
Enabled bool `json:"enabled" yaml:"-" env:"PICOCLAW_CHANNELS_VK_ENABLED"`
Token SecureString `json:"token,omitzero" yaml:"token,omitempty" env:"PICOCLAW_CHANNELS_VK_TOKEN"`
GroupID int `json:"group_id" yaml:"-" env:"PICOCLAW_CHANNELS_VK_GROUP_ID"`
AllowFrom FlexibleStringSlice `json:"allow_from" yaml:"-" env:"PICOCLAW_CHANNELS_VK_ALLOW_FROM"`
Enabled bool `json:"enabled" yaml:"-" env:"PICOCLAW_CHANNELS_VK_ENABLED"`
Token SecureString `json:"token,omitzero" yaml:"token,omitempty" env:"PICOCLAW_CHANNELS_VK_TOKEN"`
GroupID int `json:"group_id" yaml:"-" env:"PICOCLAW_CHANNELS_VK_GROUP_ID"`
AllowFrom FlexibleStringSlice `json:"allow_from" yaml:"-" env:"PICOCLAW_CHANNELS_VK_ALLOW_FROM"`
GroupTrigger GroupTriggerConfig `json:"group_trigger,omitempty" yaml:"-"`
Typing TypingConfig `json:"typing,omitempty" yaml:"-"`
Typing TypingConfig `json:"typing,omitempty" yaml:"-"`
Placeholder PlaceholderConfig `json:"placeholder,omitempty" yaml:"-"`
ReasoningChannelID string `json:"reasoning_channel_id" yaml:"-" env:"PICOCLAW_CHANNELS_VK_REASONING_CHANNEL_ID"`
ReasoningChannelID string `json:"reasoning_channel_id" yaml:"-" env:"PICOCLAW_CHANNELS_VK_REASONING_CHANNEL_ID"`
}
func (c *VKConfig) SetToken(token string) {