some fixes

This commit is contained in:
ScuroNeko 2024-12-16 00:56:15 +03:00
parent f203e3e056
commit 8f96244634
Signed by: ScuroNeko
GPG Key ID: C9081BDABF0837CA
2 changed files with 7 additions and 8 deletions

13
bot.go
View File

@ -6,20 +6,19 @@ import (
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
"scurotgbot/utils"
"strings" "strings"
) )
type Bot struct { type Bot struct {
token string token string
logger *utils.Logger logger *Logger
debug bool debug bool
plugins []*Plugin plugins []*Plugin
prefixes []string prefixes []string
updateOffset int updateOffset int
updateQueue *utils.Queue[*Update] updateQueue *Queue[*Update]
} }
type MsgContext struct { type MsgContext struct {
@ -31,9 +30,9 @@ type MsgContext struct {
} }
func NewBot(token string) *Bot { func NewBot(token string) *Bot {
logger := utils.Create() logger := CreateLogger()
logger.SetLevel(utils.DEBUG) logger.SetLevel(DEBUG)
updateQueue := utils.CreateQueue[*Update](256) updateQueue := CreateQueue[*Update](256)
bot := &Bot{ bot := &Bot{
updateOffset: 0, plugins: make([]*Plugin, 0), debug: false, updateOffset: 0, plugins: make([]*Plugin, 0), debug: false,
prefixes: make([]string, 0), prefixes: make([]string, 0),
@ -124,7 +123,7 @@ func (b *Bot) SetDebug(debug bool) {
b.debug = debug b.debug = debug
} }
func (b *Bot) GetQueue() *utils.Queue[*Update] { func (b *Bot) GetQueue() *Queue[*Update] {
return b.updateQueue return b.updateQueue
} }

View File

@ -51,7 +51,7 @@ var methodLevelMap = map[string]LogLevel{
"get": GET, "post": POST, "put": PUT, "delete": DELETE, "get": GET, "post": POST, "put": PUT, "delete": DELETE,
} }
func Create() *Logger { func CreateLogger() *Logger {
return &Logger{ return &Logger{
prefix: "LOG", prefix: "LOG",
level: FATAL, level: FATAL,