Change project structure a bit
This commit is contained in:
+8
-8
@@ -14,11 +14,11 @@ var fieldMap = logrus.FieldMap{
|
||||
}
|
||||
|
||||
type Logger interface {
|
||||
WithField(key string, value interface{}) Logger
|
||||
WithField(key string, value any) Logger
|
||||
|
||||
Info(...interface{})
|
||||
Error(error, ...interface{})
|
||||
FatalError(error, ...interface{})
|
||||
Info(...any)
|
||||
Error(error, ...any)
|
||||
FatalError(error, ...any)
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
@@ -42,14 +42,14 @@ type logger struct {
|
||||
logrus.FieldLogger
|
||||
}
|
||||
|
||||
func (l *logger) WithField(key string, value interface{}) Logger {
|
||||
func (l *logger) WithField(key string, value any) Logger {
|
||||
return &logger{l.FieldLogger.WithField(key, value)}
|
||||
}
|
||||
|
||||
func (l *logger) Error(err error, args ...interface{}) {
|
||||
l.FieldLogger.WithError(err).Error(args)
|
||||
func (l *logger) Error(err error, args ...any) {
|
||||
l.FieldLogger.WithError(err).Error(args...)
|
||||
}
|
||||
|
||||
func (l *logger) FatalError(err error, args ...interface{}) {
|
||||
func (l *logger) FatalError(err error, args ...any) {
|
||||
l.FieldLogger.WithError(err).Fatal(args...)
|
||||
}
|
||||
+7
-1
@@ -2,8 +2,9 @@ package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/nightnoryu/anon3anon/pkg/anon3anon/infrastructure/jsonlog"
|
||||
"github.com/nightnoryu/anon3anon/pkg/infrastructure/jsonlog"
|
||||
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
@@ -15,6 +16,11 @@ func NewAnonymousMessagesHandler(logger jsonlog.Logger, ownerChatId int) bot.Han
|
||||
return
|
||||
}
|
||||
|
||||
if ownerChatId == 0 {
|
||||
logger.Info(fmt.Sprintf("owner chat ID not set. set to %d to use the last chat", update.Message.Chat.ID))
|
||||
return
|
||||
}
|
||||
|
||||
params := &bot.CopyMessageParams{
|
||||
ChatID: ownerChatId,
|
||||
FromChatID: update.Message.Chat.ID,
|
||||
+1
-1
@@ -3,7 +3,7 @@ package handler
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/nightnoryu/anon3anon/pkg/anon3anon/infrastructure/jsonlog"
|
||||
"github.com/nightnoryu/anon3anon/pkg/infrastructure/jsonlog"
|
||||
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/nightnoryu/anon3anon/pkg/anon3anon/infrastructure/jsonlog"
|
||||
"github.com/nightnoryu/anon3anon/pkg/infrastructure/jsonlog"
|
||||
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
Reference in New Issue
Block a user