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:
parent
39377a21ff
commit
ee49136002
2 changed files with 6 additions and 17 deletions
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/SevereCloud/vksdk/v3/api"
|
"github.com/SevereCloud/vksdk/v3/api"
|
||||||
"github.com/SevereCloud/vksdk/v3/api/params"
|
"github.com/SevereCloud/vksdk/v3/api/params"
|
||||||
|
|
@ -27,7 +26,6 @@ type VKChannel struct {
|
||||||
config *config.Config
|
config *config.Config
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
mu sync.Mutex
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewVKChannel(cfg *config.Config, bus *bus.MessageBus) (*VKChannel, error) {
|
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)
|
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 {
|
func (c *VKChannel) getUserName(userID int) string {
|
||||||
users, err := c.vk.UsersGet(api.Params{
|
users, err := c.vk.UsersGet(api.Params{
|
||||||
"user_ids": userID,
|
"user_ids": userID,
|
||||||
|
|
|
||||||
|
|
@ -549,14 +549,14 @@ type IRCConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type VKConfig struct {
|
type VKConfig struct {
|
||||||
Enabled bool `json:"enabled" yaml:"-" env:"PICOCLAW_CHANNELS_VK_ENABLED"`
|
Enabled bool `json:"enabled" yaml:"-" env:"PICOCLAW_CHANNELS_VK_ENABLED"`
|
||||||
Token SecureString `json:"token,omitzero" yaml:"token,omitempty" env:"PICOCLAW_CHANNELS_VK_TOKEN"`
|
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"`
|
GroupID int `json:"group_id" yaml:"-" env:"PICOCLAW_CHANNELS_VK_GROUP_ID"`
|
||||||
AllowFrom FlexibleStringSlice `json:"allow_from" yaml:"-" env:"PICOCLAW_CHANNELS_VK_ALLOW_FROM"`
|
AllowFrom FlexibleStringSlice `json:"allow_from" yaml:"-" env:"PICOCLAW_CHANNELS_VK_ALLOW_FROM"`
|
||||||
GroupTrigger GroupTriggerConfig `json:"group_trigger,omitempty" yaml:"-"`
|
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:"-"`
|
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) {
|
func (c *VKConfig) SetToken(token string) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue