fix golint errors
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -93,8 +94,12 @@ func (b *Bot) nextSendTime() time.Time {
|
||||
hour := 9
|
||||
minute := 0
|
||||
if len(parts) == 2 {
|
||||
fmt.Sscanf(parts[0], "%d", &hour)
|
||||
fmt.Sscanf(parts[1], "%d", &minute)
|
||||
if h, err := strconv.Atoi(parts[0]); err == nil {
|
||||
hour = h
|
||||
}
|
||||
if m, err := strconv.Atoi(parts[1]); err == nil {
|
||||
minute = m
|
||||
}
|
||||
}
|
||||
|
||||
target := time.Date(now.Year(), now.Month(), now.Day(), hour, minute, 0, 0, b.loc)
|
||||
@@ -185,7 +190,7 @@ type imageFile struct {
|
||||
|
||||
// downloadImages downloads image attachments, skipping failures.
|
||||
func (b *Bot) downloadImages(ctx context.Context, attachments []memos.Attachment) []imageFile {
|
||||
var files []imageFile
|
||||
files := make([]imageFile, 0, len(attachments))
|
||||
for _, att := range attachments {
|
||||
data, err := b.client.DownloadAttachment(ctx, att)
|
||||
if err != nil {
|
||||
|
||||
@@ -41,7 +41,7 @@ func formatMemory(mem *search.Memory, publicURL string) (mainText, captionText s
|
||||
|
||||
// Link to original
|
||||
memoURL := fmt.Sprintf("%s/%s", publicURL, mem.Memo.Name)
|
||||
b.WriteString(fmt.Sprintf("\n\n<a href=\"%s\">Оригинал</a>", memoURL))
|
||||
b.WriteString("\n\n<a href=\"" + memoURL + "\">Оригинал</a>")
|
||||
|
||||
full := b.String()
|
||||
mainText = truncateHTML(full, maxMessageLen)
|
||||
|
||||
Reference in New Issue
Block a user