fix package

This commit is contained in:
LPF
2026-03-10 00:33:23 +08:00
parent e9a47ac02a
commit c18fdb690e
85 changed files with 381 additions and 316 deletions

View File

@@ -10,8 +10,8 @@ import (
"sync/atomic"
"time"
"clawgo/pkg/bus"
"clawgo/pkg/logger"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/logger"
)
type Channel interface {

View File

@@ -6,8 +6,8 @@ import (
"testing"
"time"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/config"
)
type recordingChannel struct {
@@ -15,11 +15,11 @@ type recordingChannel struct {
sent []bus.OutboundMessage
}
func (r *recordingChannel) Name() string { return "test" }
func (r *recordingChannel) Start(ctx context.Context) error { return nil }
func (r *recordingChannel) Stop(ctx context.Context) error { return nil }
func (r *recordingChannel) IsRunning() bool { return true }
func (r *recordingChannel) IsAllowed(senderID string) bool { return true }
func (r *recordingChannel) Name() string { return "test" }
func (r *recordingChannel) Start(ctx context.Context) error { return nil }
func (r *recordingChannel) Stop(ctx context.Context) error { return nil }
func (r *recordingChannel) IsRunning() bool { return true }
func (r *recordingChannel) IsAllowed(senderID string) bool { return true }
func (r *recordingChannel) HealthCheck(ctx context.Context) error { return nil }
func (r *recordingChannel) Send(ctx context.Context, msg bus.OutboundMessage) error {
r.mu.Lock()
@@ -78,7 +78,6 @@ func TestBaseChannel_HandleMessage_ContentHashFallbackDedupe(t *testing.T) {
}
}
func TestDispatchOutbound_DifferentButtonsShouldNotDeduplicate(t *testing.T) {
mb := bus.NewMessageBus()
mgr, err := NewManager(&config.Config{}, mb)

View File

@@ -8,9 +8,9 @@ import (
"fmt"
"sync"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/logger"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/logger"
"github.com/open-dingtalk/dingtalk-stream-sdk-go/chatbot"
"github.com/open-dingtalk/dingtalk-stream-sdk-go/client"
)

View File

@@ -1,11 +1,11 @@
package channels
import (
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/logger"
"context"
"fmt"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/logger"
"io"
"net/http"
"os"

View File

@@ -22,9 +22,9 @@ import (
larksheets "github.com/larksuite/oapi-sdk-go/v3/service/sheets/v3"
larkws "github.com/larksuite/oapi-sdk-go/v3/ws"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/logger"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/logger"
)
type FeishuChannel struct {
@@ -135,7 +135,7 @@ func (c *FeishuChannel) Send(ctx context.Context, msg bus.OutboundMessage) error
logger.WarnCF("feishu", logger.C0045, map[string]interface{}{logger.FieldError: lerr.Error(), logger.FieldChatID: msg.ChatID})
continue
}
links = append(links, fmt.Sprintf("表格%d: %s", i+1, link))
links = append(links, fmt.Sprintf("琛ㄦ牸%d: %s", i+1, link))
}
if len(links) > 0 {
if strings.TrimSpace(workMsg.Content) != "" {
@@ -903,9 +903,9 @@ func normalizeFeishuText(s string) string {
// Headers: "## title" -> "title"
s = regexp.MustCompile(`(?m)^#{1,6}\s+`).ReplaceAllString(s, "")
// Bullet styles
s = regexp.MustCompile(`(?m)^[-*]\s+`).ReplaceAllString(s, "")
s = regexp.MustCompile(`(?m)^[-*]\s+`).ReplaceAllString(s, "鈥?")
// Ordered list to bullet for readability
s = regexp.MustCompile(`(?m)^\d+\.\s+`).ReplaceAllString(s, "")
s = regexp.MustCompile(`(?m)^\d+\.\s+`).ReplaceAllString(s, "鈥?")
// Bold/italic/strike markers
s = regexp.MustCompile(`\*\*(.*?)\*\*`).ReplaceAllString(s, `$1`)
s = regexp.MustCompile(`__(.*?)__`).ReplaceAllString(s, `$1`)

View File

@@ -7,9 +7,9 @@ import (
"net"
"sync"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/logger"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/logger"
)
type MaixCamChannel struct {
@@ -161,7 +161,7 @@ func (c *MaixCamChannel) handlePersonDetection(msg MaixCamMessage) {
w, _ := msg.Data["w"].(float64)
h, _ := msg.Data["h"].(float64)
content := fmt.Sprintf("📷 Person detected!\nClass: %s\nConfidence: %.2f%%\nPosition: (%.0f, %.0f)\nSize: %.0fx%.0f",
content := fmt.Sprintf("馃摲 Person detected!\nClass: %s\nConfidence: %.2f%%\nPosition: (%.0f, %.0f)\nSize: %.0fx%.0f",
classInfo, score*100, x, y, w, h)
metadata := map[string]string{

View File

@@ -16,9 +16,9 @@ import (
"sync/atomic"
"time"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/logger"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/logger"
"golang.org/x/sync/errgroup"
"golang.org/x/time/rate"
)

View File

@@ -13,9 +13,9 @@ import (
"github.com/tencent-connect/botgo/token"
"golang.org/x/oauth2"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/logger"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/logger"
)
type QQChannel struct {

View File

@@ -20,9 +20,9 @@ import (
"github.com/mymmrac/telego/telegoutil"
"golang.org/x/time/rate"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/logger"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/logger"
)
const (
@@ -1144,15 +1144,15 @@ func markdownToTelegramHTML(text string) string {
text = escapeHTML(text)
text = regexp.MustCompile("(?m)^#{1,6}\\s+(.+)$").ReplaceAllString(text, "<b>$1</b>")
text = regexp.MustCompile("(?m)^>\\s*(.*)$").ReplaceAllString(text, "$1")
text = regexp.MustCompile("(?m)^>\\s*(.*)$").ReplaceAllString(text, "鈹?$1")
text = regexp.MustCompile("\\[([^\\]]+)\\]\\(([^)]+)\\)").ReplaceAllString(text, `<a href="$2">$1</a>`)
text = regexp.MustCompile("\\*\\*(.+?)\\*\\*").ReplaceAllString(text, "<b>$1</b>")
text = regexp.MustCompile("__(.+?)__").ReplaceAllString(text, "<b>$1</b>")
text = regexp.MustCompile("\\*([^*\\n]+)\\*").ReplaceAllString(text, "<i>$1</i>")
text = regexp.MustCompile("_([^_\\n]+)_").ReplaceAllString(text, "<i>$1</i>")
text = regexp.MustCompile("~~(.+?)~~").ReplaceAllString(text, "<s>$1</s>")
text = regexp.MustCompile("(?m)^[-*]\\s+").ReplaceAllString(text, "")
text = regexp.MustCompile("(?m)^\\d+\\.\\s+").ReplaceAllString(text, "")
text = regexp.MustCompile("(?m)^[-*]\\s+").ReplaceAllString(text, "鈥?")
text = regexp.MustCompile("(?m)^\\d+\\.\\s+").ReplaceAllString(text, "鈥?")
for i, code := range inlineCodes.codes {
escaped := escapeHTML(code)

View File

@@ -5,7 +5,7 @@ import (
"errors"
"sync"
"clawgo/pkg/logger"
"github.com/YspCoder/clawgo/pkg/logger"
)
func truncateString(s string, maxLen int) string {

View File

@@ -13,9 +13,9 @@ import (
"github.com/gorilla/websocket"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/logger"
"github.com/YspCoder/clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/logger"
)
type WhatsAppChannel struct {

View File

@@ -6,7 +6,7 @@ import (
"testing"
"time"
"clawgo/pkg/bus"
"github.com/YspCoder/clawgo/pkg/bus"
waProto "go.mau.fi/whatsmeow/proto/waE2E"
"go.mau.fi/whatsmeow/types"
"google.golang.org/protobuf/proto"

View File

@@ -3,7 +3,7 @@ package channels
import (
"testing"
"clawgo/pkg/config"
"github.com/YspCoder/clawgo/pkg/config"
)
func TestWhatsAppShouldHandleIncomingMessage(t *testing.T) {